Private Sub Combo1_Click() Label1.Caption = Right(Combo1.Text, 3) End SubPrivate Sub Form_Load() Combo1.AddItem "abc:123" Combo1.AddItem "abc:124" End Sub
Private Sub Combo1_Click() Dim a() As String a = Split(Combo1.Text, ":") If UBound(a) >= 1 Then Label1 = a(1) End If End Sub
Private Sub Combo1_Click()dim StrA as string StrA =split(Combo1.Text,":")(1) Label1.Caption = StrA End Sub
Private Sub Combo1_Click() Dim S If Combo1.Text = "abc:123" Then '如果选中项的内容等于"abc:123" S = Split(Combo1.Text, ":") '将选中的内容以冒号分割,导入变体型变量 If UBound(S) >= 1 Then Label1.Caption = S(1) '>=1表示变量中确保含有分隔符冒号 End If End Sub
Label 控件的默认属性是 Caption,所以可以省略。
Private Sub Combo1_Click() Label1.Caption = Split(Combo1.Text, ":")(1) End SubPrivate Sub Form_Load() Combo1.AddItem "abc:123" Combo1.AddItem "abc:124" End Sub
Label1.Caption = Right(Combo1.Text, 3)
End SubPrivate Sub Form_Load()
Combo1.AddItem "abc:123"
Combo1.AddItem "abc:124"
End Sub
Dim a() As String
a = Split(Combo1.Text, ":")
If UBound(a) >= 1 Then
Label1 = a(1)
End If
End Sub
Private Sub Combo1_Click()dim StrA as string
StrA =split(Combo1.Text,":")(1)
Label1.Caption = StrA
End Sub
测试通过 -.-
可 这句不太理解 Label1 = a(1)
等同 Label1.Caption = a(1) ?
Dim S
If Combo1.Text = "abc:123" Then '如果选中项的内容等于"abc:123"
S = Split(Combo1.Text, ":") '将选中的内容以冒号分割,导入变体型变量
If UBound(S) >= 1 Then Label1.Caption = S(1) '>=1表示变量中确保含有分隔符冒号
End If
End Sub
Private Sub Combo1_Click()
Label1.Caption = Split(Combo1.Text, ":")(1)
End SubPrivate Sub Form_Load()
Combo1.AddItem "abc:123"
Combo1.AddItem "abc:124"
End Sub