I've ran into a quirky issue and I can't seem to find a solution. Working on an textbook assignment. It's basically done, but I got one bug. Basically, I have popup window where the user enter's a soccer player's first and last names with a separate textbox for each. When it loops to players 2 or higher, it's putting the focus in the last name textbox, instead of the first name. I've changed the tab order and tried using txtfirstname.focus() to no avail in both the form load and click event that calls the form.
I couldn't think of what else would be helpful. I attached a zip file of the application.
Code:
Private Sub PlayerNamesForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = "Player " & (intPlayerNameCounter.ToString + 1) & " Name Input"
lblFirstName.Text = "Player " & (intPlayerNameCounter.ToString + 1) & "'s first name"
lblLastName.Text = "Player " & (intPlayerNameCounter.ToString + 1) & "'s last name"
txtLastName.Clear()
txtFirstName.Clear()
txtFirstName.Focus()
End Sub
Code:
Private Sub btnAddPlayerNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddPlayerNames.Click
'declare local variables
Dim frmPlayerNamesForm As New PlayerNamesForm
'get player names
blnCancel = False 'reset boolean
If intSuperScript > 0 Then 'check to see if team size set
For GeneralModule.intPlayerNameCounter = 0 To intSuperScript
frmPlayerNamesForm.ShowDialog()
If blnCancel = True Then
Exit For 'exit loop from hitting cancel button
End If
Next
'display error message
Else
'do not give player name entry form
MessageBox.Show("need to have team size set")
blnCancel = True
End If
[code removed]
End Sub