Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear text box when receiving focus 2

Status
Not open for further replies.

Raccoon

Programmer
Aug 18, 1999
92
US
I am having trouble clearing text boxes when they receive focus. This requires the user to backspace or highlight/delete before typing in new info. What have I done wrong?

I don't want to have to put this.value = "" in each gotfocus event.
 
how about create a class Mytextbox based on TextBox class, and then in the gotfocus of the Mytextbox:

this.value = ""

and then use the mytextbox in your form. Please let me know if this helped you :)

Tekno
Wireless Toyz
Ypsilanti, Michigan
 
how about create a class Mytextbox based on TextBox class, and then in the gotfocus of the Mytextbox:

this.value = ""

and then use the mytextbox in your form. Please let me know if this helped you :)

Tekno
Wireless Toyz
Ypsilanti, Michigan
 
While it won't clear the textbox, if you set the SelectOnEntry to .T., then the first keystroke will delete anything already there.

As Tekno suggest, you should always use your own classes, so a change in this class affects all the controls.

Rick
 
Raccoon

May I ask how you can arrive at a situation, where you would need to clear the values of all your textboxes on a form as they receive focus? Is it possibly a design issue?
 
APPENDing a blank record if a table is the control source, or SCATTER MEMVAR BLANK or m.MyVar = SPACE(Whatever) if a variable is the control source, should take care of clearing the text boxes for you.

Dave S.
 
It all started when I could not get selected on entry to work. I was grabbing at straws to clear the box when I came back into it. I finally found that if I used the builder and chose selected on entry, it worked. At this point, I don't know why the normal setting it in properties did not work, but time schedules preclude me from investigating further. Maybe once this project is finished :)

Thanks all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top