Hi, I have a piece of code which loops through checked checkboxes to do something with each of them. After each turn in the loop I want to pause before it continues to the next checkbox until the user enters a piece of text into the text box.
I have tried something like this but haven't had any sucess, I'm still quite new to VB.Net so please bare with me!
Private keypressed as Boolean = False
Private Sub txtCurrentCaptcha_keyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtCurrentCaptcha.KeyDown
If e.KeyCode = Keys.Enter Then
keypressed = True
End If
End Sub
Private Sub joinChar()
If lstRaidsForming.SelectedIndex >= 0 Then ' Check for a selected item
Dim raidItem As String = lstRaidsForming.SelectedItem.ToString
Dim raidName As String = w.iB(raidItem, "name=", " id=")
Dim raidID As String = w.iB(raidItem, "id=", " ")
zraidID = raidID
If lstChars.CheckedItems.Count > 0 Then ' Check for checked checkboxes
For i As Integer = 0 To lstChars.CheckedItems.Count - 1 ' Loop through the checked checkboxes
keypressed = False ' Reset keypressed before entering while loop again
While keypressed = False ' Whilst the enter key isn't pressed do ...
Dim characterItem As ListViewItem = lstChars.CheckedItems(i) ' get the item at index i
Dim characterID As String
Dim charName As String
characterID = characterItem.SubItems(1).Text
charName = characterItem.SubItems(0).Text
zcharID = characterID
Dim getImg As String = getCaptchaImage(characterID, raidID)
End While
Next
Else
MsgBox("Error: No characters selected.")
Exit Sub
End If
Else
MsgBox("Error: Must select a raid")
Exit Sub
End If
End Sub
But I realise my problem and that is that I am now stuck in a neverending while loop, I've tried a few other ways but still can't find a solution to this!
Any help would be greatly appreciated.
David.