SlinkRN
Well-known Member
- Joined
- Oct 29, 2002
- Messages
- 724
Hi all, I can't seem to figure this one out by searching. It seems to be such a simple thing! I have a text box that fills a listbox with team names. After the user fills in a bunch of team names, I would like them to be able to click on one of the names in the listbox and edit it. I've tried this code but it is an infinite loop. Can anyone help me figure this out?
<code>
Private Sub lstTeams_Click()
Dim i As Integer
Dim sel As String
Dim chg As String
For i = 0 To ListBox1.ListCount - 1
If lstTeams.Selected(i) Then
sel = lstTeams.List(i)
chg = InputBox("Edit Item here", "Edit Name")
lstTeams.List(i) = chg
End If
Next i
End Sub
</code>
<code>
Private Sub lstTeams_Click()
Dim i As Integer
Dim sel As String
Dim chg As String
For i = 0 To ListBox1.ListCount - 1
If lstTeams.Selected(i) Then
sel = lstTeams.List(i)
chg = InputBox("Edit Item here", "Edit Name")
lstTeams.List(i) = chg
End If
Next i
End Sub
</code>