有没有办法根据 TrackBar 中的值范围指示 if-then 语句? (VB.NET)

Is there a way to indicate an if-then statement based on a value range in a TrackBar? (VB.NET)

我想在我的 Visual Studio 项目中使用 TrackBar。我的目标是让用户滚动 TrackBar 的指示器,并根据它所处的值范围,更改标签的文本。

这是我如何尝试完成此操作的示例:

Private Sub ScrollBarProgress() Handles MyBase.Load
        If SelfEvaluationReportBAR.Value = (0) Then
            FeelingLBL.Text = "Please select a value."
        End If
        If SelfEvaluationReportBAR.Value = (1, 25) Then
            FeelingLBL.Text = "I am starting to develop my ability to perform this task."
        End If
        If SelfEvaluationReportBAR.Value = (26, 50) Then
            FeelingLBL.Text = "I feel improvement in my ability to perform this task."
        End If
        If SelfEvaluationReportBAR.Value = (51, 75) Then
            FeelingLBL.Text = "My confidence in my ability to perform this task is substantial."
        End If
        If SelfEvaluationReportBAR.Value = (76, 100) Then
            FeelingLBL.Text = "I feel fully confident in my ability to efficiently and accurately perform the day to day tasks that are assigned to me."
        End If
    End Sub

问题是每当我尝试设置范围时,都会出现以下错误:

Error BC30452 Operator '=' is not defined for types 'Integer' and '(Integer, Integer)'.

我想我的格式有误。有没有人对范围可以/应该如何格式化有任何想法?

这是我当前的 TrackBar 设置:

Private Sub SelfEvaluationReportBAR_Scroll(sender As Object, e As EventArgs) Handles MyBase.Load
        SelfEvaluationReportBAR.Minimum = 0
        SelfEvaluationReportBAR.Maximum = 100
        SelfEvaluationReportBAR.SmallChange = 1
        SelfEvaluationReportBAR.LargeChange = 5
        SelfEvaluationReportBAR.TickFrequency = 5
    End Sub
End Class

有多种方法可以完成您的任务

第一个

If SelfEvaluationReportBAR.Value >= 1 AndAlso SelfEvaluationReportBAR.Value <= 25) Then
    FeelingLBL.Text = "I am starting to develop my ability to perform this task."
End If

第二

Select case SelfEvaluationReportBAR.Value
   Case 0
      ....
   Case 1 To 25
      FeelingLBL.Text = "I am starting to develop my ability to perform this task."
   Case 26 To 50
      ...
   ' Other case follow
End Select

第三

If Enumerable.Range(1, 25).Contains(c) Then
    FeelingLBL.Text = "I am starting to develop my ability to perform this task."
End If

想到的就是这些方法,可能还有其他的。

前两个示例是最基本的方法,只有五个范围,我会继续使用简单的 If 方法。第三个只是为了展示存在多少种方式,但我真的不建议建立一个可枚举范围只是为了检查是否包含一个数字。