|
-
Jun 1st, 2002, 04:31 PM
#1
Thread Starter
Lively Member
setting a focus on a textbox
is there a way to set the focus of a textbox to false after data is inserted into it?
-
Jun 1st, 2002, 04:38 PM
#2
Addicted Member
You could make it read only, but that won't stop it from getting the focus.
You could disable it.
You could set the tabstop to false. A user would have to click it manually to set the focus on it.
Any of these help?
That which does not kill us, only makes us stronger. 
-
Jun 1st, 2002, 04:50 PM
#3
Thread Starter
Lively Member
the only problem is that my program automatically inserts text, and when it inserts the text it gives the focus to the textbox.
i'm thinking i could try something like making an invisible checkbox and checking it after the text is entered.
thanks for the help.
-
Jun 1st, 2002, 08:24 PM
#4
Lively Member
What about putting the the textbox in a frame controle and then disable the frame after you've added the data, would that send the focus to another controle, don't know if that will work though
Last edited by SAS-Trooper; Jun 1st, 2002 at 08:30 PM.
-
Jun 1st, 2002, 10:09 PM
#5
Thread Starter
Lively Member
problem narrowed down
well, i think i've narrowed down the problem. i have the code: "If textbox1.focus = false then..." on my group Leave event. so when i compile and click on any control outside my group (when i leave the group) and my code subsequently checks to see if the textbox focus is false, it GIVES the textbox focus.
the first click on a control outside my group does not activate the control, but gives the textbox focus. i've now left my group and the textbox has focus, but the control hasn't responded (which was the point of clicking on it). only after another click (after i've left the group) will the control respond. if i leave out the code to check if the textbox has focus everything works fine.
this can't be how it's supposed to work can it?
-
Jun 2nd, 2002, 10:44 AM
#6
Addicted Member
If textbox1.focus = fasle
textbox1.focus is actually a function call that will give the control the focus. The return value from that call is being evaluated by your if statement.
Maybe you can set a flag in the controls enter/leave event to determine if it has the focus. I'm not on a computer with .NET, so I can't check to see for sure, but I don't think you could get lucky enough for there to be a HasFocus property.
That which does not kill us, only makes us stronger. 
-
Jun 2nd, 2002, 10:53 AM
#7
Addicted Member
Try the ContainsFocus or Focused property. ContainsFocus will look at child controls as well as the parent. Hope this helps.
That which does not kill us, only makes us stronger. 
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
|