|
-
Oct 1st, 2004, 01:06 AM
#1
Thread Starter
Hyperactive Member
Setting focus to a textbox (RESOLVED)
Hello everybody
I`m trying to do something rather simple, which is trying to set the focus on a textbox from within a Form`s load event. Unfortunately I`m getting a runtime error on that code.
Does anyone have some idea?
thx, in advance
George Papadopoulos
Last edited by divined; Oct 1st, 2004 at 01:37 AM.
SteadFast!
-
Oct 1st, 2004, 01:11 AM
#2
You cannot set Focus to a control whose Visible or Enabled properties are False. The Visible property of a control is False until the Form is shown.
Three ways around this.
Move the SetFocus code to the Form Activate event.
Call the Show method in Form Load event and then call SetFocus.
Set the TabIndex of the text box to 0 and remove the call to SetFocus.
-
Oct 1st, 2004, 01:35 AM
#3
Thread Starter
Hyperactive Member
ok. thx! I used the Form Activate event handler to set the focus and now it worked!
George Papadopoulos
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|