|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Error with command button
I have 2 command buttons 1 that add's to a list that goes like:
Code:
Private Sub Command1_Click() lstwindows4.AddItem Text1.Text Text1.Text = "" End Sub Which works fine and does what i want - but I have another command button which when clicked should delete an entry from the list if selected: Code:
Private Sub Command2_Click() ty = lstwindows4.ListCount For ber = 0 To ty - 1 lstwindows4.ListIndex = ber If lstwindows4.Text = Text2.Text Then lstwindows4.RemoveItem ber Text2.Text = "" Exit Sub End If Next ber Text2.Text = "" End Sub it does not seem to delete from the list? any help is appreciated ![]() |
|
#2
|
||||
|
||||
|
Try something like this:
Code:
cnt = lstListName.ListCount
For cntr = 0 To lstListName.ListCount - 1
If txtTextField = lstListName.List(cntr) Then
lstListName.RemoveItem cntr
txtTextField = vbNullString
Exit Sub
End If
Next
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Error with command button |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|