How do you allow the controls of an application to go back to the cursor of the textbox after checking that the textbox has an empty input? what i want is just the cursor back to the textbox to allow easy user access. thx :)

txtReminder.?????

Recommended Answers

All 9 Replies

If i have understood you correctly, then what you need is txtReminder.Focus().

Thx you the problem above is solved:) Another problem posed is do you know how to somehow auto hide a menustrip of the GUI, and only when you hover your key over then it reappears?

I think you may want txtReminder.Select(); [Edit]@Ryshad:

The Focus method returns true if the control successfully received input focus. The control can have the input focus while not displaying any visual cues of having the focus. This behavior is primarily observed by the nonselectable controls listed below, or any controls derived from them.

Focus is a low-level method intended primarily for custom control authors. Instead, application programmers should use the Select method or the ActiveControl property for child controls, or the Activate method for forms.

commented: thanks for highlighting a bad habit :p +2

If your problem was solved remember to Mark This Thread as Solved.
Please try not to add new questions to old threads, it makes it harder for others find the solution posted and also limits the help you might receive.

The easiest way to "autohide" the menustrip is to set its Visible property to false then set it to True whenever the mouse enters it. Since it is not visible it wont fire its own MouseEnter or MouseLeave events so you can use the form's MouseMove event. See if you can find a way to tell if the mouse is over the control. if you get stuck post a new thread and we'll guide you through it.

@nick.crane - Wow, i am so not on form today. I may just retire whilst I'm very much not ahead lol.
I've used .Focus for years, and don't really read the msdn pages about stuff i already know :/ I learnt something here..time to break some old habits lol.

hmmmm so which method should i use? Both method seems to be able to do the trick? i'm lost?

Use the one nick.crane showed you. The .Focus method "works" but is not intended for this purpose.

ok thz:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.