Private Sub CmbColor_Click()
For i = 0 To CmbColor.ListCount - 1
If CmbColor.ListIndex = i Then
If CmbColor.List(i) = "Red" Then
Label1.BackColor = vbRed
ElseIf CmbColor.List(i) = "Green" Then
Label1.BackColor = vbGreen
ElseIf CmbColor.List(i) = "Blue" Then
Label1.BackColor = vbBlue
ElseIf CmbColor.List(i) = "White" Then
Label1.BackColor = vbWhite
Else
Label1.BackColor = vbYellow
End If
End If
Next
End Sub
Private Sub CmbNames_Click()
For i = 0 To CmbNames.ListCount - 1
If CmbNames.ListIndex = i Then
Label1.Caption = CmbNames.List(i)
End If
Next
End Sub
Private Sub Form_Load()
CmbNames.AddItem "Red Color"
CmbNames.AddItem "Green Color"
CmbNames.AddItem "Blue Color"
CmbNames.AddItem "White Color"
CmbNames.AddItem "Yellow Color"
CmbColor.AddItem "Red"
CmbColor.AddItem "Green"
CmbColor.AddItem "Blue"
CmbColor.AddItem "White"
CmbColor.AddItem "Yellow"
End Sub
For i = 0 To CmbColor.ListCount - 1
If CmbColor.ListIndex = i Then
If CmbColor.List(i) = "Red" Then
Label1.BackColor = vbRed
ElseIf CmbColor.List(i) = "Green" Then
Label1.BackColor = vbGreen
ElseIf CmbColor.List(i) = "Blue" Then
Label1.BackColor = vbBlue
ElseIf CmbColor.List(i) = "White" Then
Label1.BackColor = vbWhite
Else
Label1.BackColor = vbYellow
End If
End If
Next
End Sub
Private Sub CmbNames_Click()
For i = 0 To CmbNames.ListCount - 1
If CmbNames.ListIndex = i Then
Label1.Caption = CmbNames.List(i)
End If
Next
End Sub
Private Sub Form_Load()
CmbNames.AddItem "Red Color"
CmbNames.AddItem "Green Color"
CmbNames.AddItem "Blue Color"
CmbNames.AddItem "White Color"
CmbNames.AddItem "Yellow Color"
CmbColor.AddItem "Red"
CmbColor.AddItem "Green"
CmbColor.AddItem "Blue"
CmbColor.AddItem "White"
CmbColor.AddItem "Yellow"
End Sub