Testing the visible property of a windows form control (textbox) does not seem to work until after the form has fully loaded. I've tried in the Load, Activated, and Focus events. It only works after the form has completely loaded and some action (keypress) is performed. I want to focus to the first blank textbox, so I'm testing for visibile=true and = "".
I've even tried to from the calling form to refocus after creating the form and before showdialog. No Luck.
Any Ideas?
Thanks, Josh
VB.NET:
Private Sub form_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.GotFocus
TextBox1.Visible = True (Note: set to false in designer)
if TextBox1.Visible = True Then
TextBox1.focus()
End if
End Sub
I've even tried to from the calling form to refocus after creating the form and before showdialog. No Luck.
VB.NET:
Dim frm As System.Windows.Forms.Form
frm = CType(Activator.CreateInstance(FormToOpen), System.Windows.Forms.Form)
frm.Focus()
frm.ShowDialog()
Any Ideas?
Thanks, Josh