briintex1
07-31-2005, 10:33 PM
Basically what I am trying to do is find out where in the listbox that the text in text14.text appears in the listbox. That is where the msgbox(smessage) comes in. So for instance if I have this, that, and these in the listbox. How would I find out out the listindex of one of those in the listbox? I have it actually highlighting what is in the listbox. Also the listbox can be sorted or it does not have to be. But can someone help me to find out where my problem is? If I take the comment out of 'List2.RemoveItem Text14.Text then it gives me a type mismatch. Also in the textbox there is just going to be strings and no numberical values in them.
Private Sub Delete_Click()
Dim I As Integer
Dim sMessage As String
sMessage = CInt(Val(Text14.Text))
MsgBox (sMessage)
'If IsNumeric(sMessage) Then
'MsgBox ("1")
For I = 0 To List1.ListIndex Step 1
MsgBox ("2")
If List1.List(I) = Text14.Text Then
List1.RemoveItem I
' Else
MsgBox "Value is not numeric"
Text14.SetFocus
End If
Next I
'End If
End Sub
Private Sub Delete_Click()
Dim I As Integer
Dim sMessage As String
sMessage = CInt(Val(Text14.Text))
MsgBox (sMessage)
'If IsNumeric(sMessage) Then
'MsgBox ("1")
For I = 0 To List1.ListIndex Step 1
MsgBox ("2")
If List1.List(I) = Text14.Text Then
List1.RemoveItem I
' Else
MsgBox "Value is not numeric"
Text14.SetFocus
End If
Next I
'End If
End Sub