>>
Home

>>
All About Me

>>
Books

>>
Events

>>
Links

>>
Photo Gallery

>>
Downloads

>>
Visual Basic .Net

>>
SE IERP

>>
FPU

>>
My Tubes



Login
Register

All content is the property of TimKey.Net unless noted otherwise in the content. All rights reserved




Set Control Focus at Startup

Posted by on Thursday, October 12, 2006 (CST)

Ever have trouble getting a control to focus at startup? Here's a way that might work for you.

Often times when developing application and using panels, getting a control to receive startup focus can be somewhat of a pain.  After much trial and error and a lot of online research into the problem, I finally found a solution that worked.

In my example I will show you how I overcame this problem using the form load event.

 

Private Sub Form1(ByVal sender As Object, ByVal e as System.EventArgs) Handles Me.Load

 

     With Me.Textbox1

          .Focus()

          .Select()

          .SelectAll()

     End With

 

End Sub

 

The key to this method is to call the focus event then the select event.  I added the SelectAll for my own personal preference.

 

Tim


Comments:

Focus
By Yasho on Sunday, May 13, 2007 (CST)

What is the way of forcing user to stop entering information in text boxes other then the box You have set focus.  After user enter the information focus shifts to next text box and user is forced to enter information before he moves to 3rd box

Yasho

Reply to this Comment

Re: Focus
By tkey on Sunday, May 13, 2007 (CST)
Disable all the text boxes except the one you want data entered into first. You could use the text change event to validate what is being entered into the current text box. Once it passed your validation test enable the second, and same for each of them. I hope this is what you were looking to do. If not provide me with some more details about what you are doing and I will help you find a solution. Tim

Reply to this Comment

Add Your Comment



Trinity Faith Fellowship

How far you go in life depends on your being tender with the young, compassionate with the aged, sympathetic with the striving and tolerant of the weak and the strong. Because someday in life you will have been all of these.
--- George Washington Carver

 

New Books

  • Enchanters' End Game
    Publishers Weekly
    "Absorbing. Touches all the right Fantasy bases. Warring gods, political intrigues, supernatural creatures, and appealingly human magicians."


  • The Misanthrope and Tartuffe
    Two classic plays translated by a Pulitzer Prize-winning poet into English verse. Introductions by Richard Wilbur.



  • Castle of Wizardry
    This is like Bonanza, or like I Love Lucy. There will be other fantasy series, but there can never be another that's so seminal, that so captures the essence of fantasy. Big Dave and Little Leigh grow their heroes from the ground up, and they grow the best.

  •  

    New Links

  • Kids and Guns
    My Daughter getting shooting lessons from my Dad. She should listen better...

  • QuickVerse Starter 2005
    Free KJV Bible for your PC. This is the best PC Bible software I have found anywhere and believe me I have looked and tested for years.

  • Free Bug Tracking Software
    Get your free version of PR-Tracker

  •  

    New Posts

  • on site visit
    Posted by linda on Friday, November 14, 2008 (CST)

  • ERP 5.2 Return Material Authorisation troubleshooting
    Posted by Noreen on Tuesday, August 12, 2008 (CST)

  • ERP 7.2 Buyers Workbench
    Posted by rcanavan on Wednesday, November 28, 2007 (CST)

  •  

    Most Popular Books
  • Loose That Man And Let Him Go
    FROM THE PUBLISHER
    Never in the history of the church has there been a time when God has so urgently stirred the hearts of men to become all He created them to be and accomplish all He created them to accomplish.


  • Why Do Men Have Nipples? Hundreds of Questions You'd Only Ask a Doctor After Your Third Martini
    Is There a Doctor in the House? You will laugh outloud as you read this book. This is one of my favorite books of all time. Told in a very humorous manner but with all seriousness, you will be enlightened about hundreds of areas of life we have al

  • Silent No More
    “Silent No More,” expounds upon the issues of our day, including judicial tyranny, race relations, poverty, homosexuality, Islam, education, and the right to life. Pastor Parsley provides practical action steps to engage readers and motivate them to act.


  • Home   |  All About Me   |  Books   |  Events   |  Links   |  Photo Gallery   |  Downloads   |  Visual Basic .Net   |  SE IERP   |  FPU   |  My Tubes