RobertoFreemano
asked on
set cursor focus in a textbox.text on lauch app (winform) vb.net 2008
Hi Experts,
I want to set the cursor focus in a textbox.text when I open the winform in run-time.
I've tried Textbox.focus, but this doesn't appear to work.
Cheers,
Roberto
I want to set the cursor focus in a textbox.text when I open the winform in run-time.
I've tried Textbox.focus, but this doesn't appear to work.
Cheers,
Roberto
ASKER
Hi leakim971,
Sadly, this did not work :(
Cheers,
Roberto
Sadly, this did not work :(
Cheers,
Roberto
Please post your code if possible.
ASKER
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.TextBox1.Focus()
End Sub
Me.TextBox1.Focus()
End Sub
ASKER
I've also set the tabIndex = 0
TabIndex should be the way to do it...is this the "startup form" or are you opening it from another one?
Perhaps something else is interfering? Do you have any third party controls in the application?
Perhaps something else is interfering? Do you have any third party controls in the application?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Idle Mind,
This is the process:
1. Form 1 = startup
2. form 1 runs splash screen form 2 for xx seconds before returning to form 1
3. form 2 has 2 buttons. if button 1 is clicked, it hides form 1 and runs form 3
4. Form 3 opens and this is were I want the focus to appear in textbox1.text
Hope this helps
P.s. I don't think I have any 3rd Party controls in the app.
Thanks,
Roberto
This is the process:
1. Form 1 = startup
2. form 1 runs splash screen form 2 for xx seconds before returning to form 1
3. form 2 has 2 buttons. if button 1 is clicked, it hides form 1 and runs form 3
4. Form 3 opens and this is were I want the focus to appear in textbox1.text
Hope this helps
P.s. I don't think I have any 3rd Party controls in the app.
Thanks,
Roberto
ASKER
Oops- amended
Hi Idle Mind,
This is the process:
1. Form 1 = startup
2. form 1 runs splash screen form 2 for xx seconds before returning to form 1
3. form 1 has 2 buttons. if button 1 is clicked, it hides form 1 and runs form 3
4. Form 3 opens and this is were I want the focus to appear in textbox1.text
Hope this helps
P.s. I don't think I have any 3rd Party controls in the app.
Thanks,
Roberto
Hi Idle Mind,
This is the process:
1. Form 1 = startup
2. form 1 runs splash screen form 2 for xx seconds before returning to form 1
3. form 1 has 2 buttons. if button 1 is clicked, it hides form 1 and runs form 3
4. Form 3 opens and this is were I want the focus to appear in textbox1.text
Hope this helps
P.s. I don't think I have any 3rd Party controls in the app.
Thanks,
Roberto
ASKER
Hi hnasr,
I tried your suggestion, and it worked.
Many thanks,
Roberto
I tried your suggestion, and it worked.
Many thanks,
Roberto
ASKER
Thanks hnasr
Can you show us the Button1 code where you open Form3 and hide Form1?
Welcome!
Try : myTextbox.Focus()
Source : http://msdn.microsoft.com/en-us/library/ms743469.aspx
Regards.