![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi I use to do a little programming in Foxpro 2. If I wanted to get an input from a form I would use the Say and Get commands. I'm now trying to wrire a program in Foxpro 8. I need a form to enter the date, in the date format. I need to save it as a memory variable to be used later in a program, I don't want this variable connected to any database, but use it to query a database and other functions. I desined the form in form designer and have a text box named txtDate. I set use the format by using this.value=date() in the Init code section. I also added a command button with the code, "display memory" I run the form, enter a date and then hit the command button, but the date is nowhere to be found in memory. Now I tried everything I could to try and save the entered date as a memory variable but just can't get to do it, HELP!!! |
#3
| |||
| |||
|
|
Often 'form properties' are a good place to store data items like this. = You can create a form property by selecting the form and choosing = Form-New Property from the VFP main menu. Then (let's say you created a form property named dDate) you could = populate it with THISFORM.dDate =3D THISFORM.txtDate.value You can check it's value by putting ? THISFORM.dDate in your command button. Your problem was probably that your memory variable was out of scope in = your command button click event handler. By using a form property, the = data is accessible from anywhere in that form. Mike Collins |
#4
| |||
| |||
|
|
Often 'form properties' are a good place to store data items like this. = You can create a form property by selecting the form and choosing = Form-New Property from the VFP main menu. Then (let's say you created a form property named dDate) you could = populate it with THISFORM.dDate =3D THISFORM.txtDate.value You can check it's value by putting ? THISFORM.dDate in your command button. Your problem was probably that your memory variable was out of scope in = your command button click event handler. By using a form property, the = data is accessible from anywhere in that form. Mike Collins JPG Thanks Mike, I ran it and it came back with a syntax error. |
#5
| |||
| |||
|
|
JP, Mike More info needed. When did the error come up? Can you copy and paste the exact code here? |
#6
| |||
| |||
|
|
JP, Mike More info needed. When did the error come up? Can you copy and paste the exact code here? LK I found part of the problem. In your post you had, THISFORM.dDate=3D THISFORM.txtDate.value I removed the 3D and placed, "THISFORM.dDate=3D THISFORM.txtDate.value" in the form ADD PROPERLY. I then placed, ? THISFORM.dDate command button. I add dDate from the VFP New Property. Now I run the form, enter a date and hit the command button, but rather than the date I get an .F. back. |
#7
| |||
| |||
|
|
Put both statements THISFORM.ddate =3D THISFORM.txtDate.Value ? THISFORM.ddate in the command button click. Mike |
#8
| |||
| |||
|
|
Put both statements THISFORM.ddate = THISFORM.txtDate.Value ? THISFORM.ddate in the command button click. Mike LK Worked, thanks a lot mike. |
![]() |
| Thread Tools | |
| Display Modes | |
| |