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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update textbox value 2

Status
Not open for further replies.

DPaul1994

Programmer
Mar 9, 2015
46
RO
Hi. Let's just say I have a checkbox named Text1 and a checkbox named Text2. I would like to do this: if Text1 is empty, Text2 = 1 else Text2 = Text1
(thisform.Text1.Value, thisform.Text2.Value)
How cna I do this?
I tried like this:

Code:
if empty(thisform.Text1.Value)
thisform.Text2.value = 1
else
thisform.Text2.value = thisform.Text1.Value
endif

But it doesn't work. When I run the program, of course that Text2 has value 1. But when I introduce a value (numeric) in Text1, I want like Text2 = Text1 (value)
 
Exactly, I am Romanian and 1994 is my birth year :) Thank you for everything, that was the solution.
 
You could also have put it right after setting Text15.Value, but nobody can read your mind and see you're already at a totally different place.

A more general hint: You put code you want to act wherever you want it to act. So calling refresh() is possible form anywhere and makes sense to refresh the display directly after changing values.

In fact as you now changed the value of the textbox programmatically, you could also let the Text15 react to that within it's ProgrammaticChange() event.

Also take a look at the property window in the Methods tab. Every Method having a flaash icon in front is actually an event. These events can happen, they are triggered by what their name typically suggests. Eg InteractiveChange event is run, ehenever a change of the value is done interactive, meaning user typing, ProgrammaticChange evnt is triggered by code changing the value property.

You should take some basic lessons in VFP, eg view
Bye, Olaf.
 
Thank you OlafDoschke, I know that site. The idea is that I'm really a beginner in FoxPro so any help is welcomed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top