[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

set cursor focus in a textbox.text on lauch app (winform) vb.net 2008

Posted on 2009-12-31
13
Medium Priority
?
1,188 Views
Last Modified: 2012-05-08
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
0
Comment
Question by:RobertoFreemano
  • 7
  • 2
  • 2
  • +1
13 Comments
 
LVL 83

Expert Comment

by:leakim971
ID: 26154236
Hello RobertoFreemano,

Try : myTextbox.Focus()

Source : http://msdn.microsoft.com/en-us/library/ms743469.aspx

Regards.
0
 

Author Comment

by:RobertoFreemano
ID: 26154285
Hi leakim971,

Sadly, this did not work :(

Cheers,
Roberto
0
 
LVL 83

Expert Comment

by:leakim971
ID: 26154350
Please post your code if possible.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:RobertoFreemano
ID: 26154436
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.TextBox1.Focus()

End Sub
0
 

Author Comment

by:RobertoFreemano
ID: 26154462
I've also set the tabIndex = 0
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 26155932
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?
0
 
LVL 31

Accepted Solution

by:
hnasr earned 200 total points
ID: 26159863
Try
TextBox1.Select ()
0
 

Author Comment

by:RobertoFreemano
ID: 26183158
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
0
 

Author Comment

by:RobertoFreemano
ID: 26183174
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
0
 

Author Comment

by:RobertoFreemano
ID: 26183364
Hi hnasr,

I tried your suggestion,  and it worked.

Many thanks,

Roberto
0
 

Author Closing Comment

by:RobertoFreemano
ID: 31671594
Thanks hnasr
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 26183402
Can you show us the Button1 code where you open Form3 and hide Form1?
0
 
LVL 31

Expert Comment

by:hnasr
ID: 26183559
Welcome!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question