Dim str As
String
Dim c As Integer
Private Sub CmdADD_Click()
str = InputBox("enter color Name:")
CmbColor.AddItem str
End Sub
Dim c As Integer
Private Sub CmdADD_Click()
str = InputBox("enter color Name:")
CmbColor.AddItem str
End Sub
Private Sub
CmdRemove_Click()
If CmbColor.ListIndex >= 0 Then
CmbColor.RemoveItem CmbColor.ListIndex
MsgBox "selected item is removed"
Else
MsgBox "plz select an item"
End If
End Sub
If CmbColor.ListIndex >= 0 Then
CmbColor.RemoveItem CmbColor.ListIndex
MsgBox "selected item is removed"
Else
MsgBox "plz select an item"
End If
End Sub
Private Sub
CmdItem_Click()
If CmbColor.ListIndex >= 0 Then
MsgBox "selected item is: " & CmbColor.List(CmbColor.ListIndex)
Else
MsgBox "plz select an item"
End If
End Sub
If CmbColor.ListIndex >= 0 Then
MsgBox "selected item is: " & CmbColor.List(CmbColor.ListIndex)
Else
MsgBox "plz select an item"
End If
End Sub
Private Sub
CmdCount_Click()
c = CmbColor.ListCount
MsgBox "total no. of items are: " & c
End Sub
c = CmbColor.ListCount
MsgBox "total no. of items are: " & c
End Sub
Private Sub
CmdLstindx_Click()
If CmbColor.ListIndex >= 0 Then
MsgBox "Index of selected item is: " & CmbColor.ListIndex
Else
MsgBox "plz select an item"
End If
End Sub
If CmbColor.ListIndex >= 0 Then
MsgBox "Index of selected item is: " & CmbColor.ListIndex
Else
MsgBox "plz select an item"
End If
End Sub
Private Sub
CmdClear_Click()
CmbColor.Clear
End Sub
Private Sub CmdAddcart_Click()
Dim check As Integer
If CmbColor.ListIndex >= 0 Then
For i = 0 To lstcolor.ListCount Step 1
If (CmbColor.List(CmbColor.ListIndex) = lstcolor.List(i)) Then
check = 1
End If
Next
If check = 1 Then
MsgBox ("Selected Color Already Exist")
Else
lstcolor.AddItem CmbColor.List(CmbColor.ListIndex)
End If
Else
MsgBox "plz select an item"
End If
End Sub
CmbColor.Clear
End Sub
Private Sub CmdAddcart_Click()
Dim check As Integer
If CmbColor.ListIndex >= 0 Then
For i = 0 To lstcolor.ListCount Step 1
If (CmbColor.List(CmbColor.ListIndex) = lstcolor.List(i)) Then
check = 1
End If
Next
If check = 1 Then
MsgBox ("Selected Color Already Exist")
Else
lstcolor.AddItem CmbColor.List(CmbColor.ListIndex)
End If
Else
MsgBox "plz select an item"
End If
End Sub
Private Sub
CmdAddAll_Click()
lstcolor.Clear
For i = 0 To CmbColor.ListCount Step 1
lstcolor.AddItem CmbColor.List(i)
Next
End Sub
lstcolor.Clear
For i = 0 To CmbColor.ListCount Step 1
lstcolor.AddItem CmbColor.List(i)
Next
End Sub
Private Sub
Cmdrmvcart_Click()
lstcolor.RemoveItem lstcolor.ListIndex
End Sub
lstcolor.RemoveItem lstcolor.ListIndex
End Sub
Private Sub
CmdRmvAll_Click()
lstcolor.Clear
End Sub
Private Sub CmdEXIT_Click()lstcolor.Clear
End Sub
End
End Sub
Output
Note:- Please set some property of your control like caption
or id corresponding to your control