dbTalk Databases Forums  

Form input

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss Form input in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
JPGREENASSOC
 
Posts: n/a

Default Form input - 12-27-2003 , 12:16 AM






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!!!

Reply With Quote
  #2  
Old   
Michael Collins
 
Posts: n/a

Default Re: Form input - 12-27-2003 , 06:05 PM






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 = 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

JPGREENASSOC wrote:
Quote:
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!!!

Reply With Quote
  #3  
Old   
JPGREENASSOC
 
Posts: n/a

Default Re: Form input - 12-27-2003 , 09:14 PM



Quote:
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.


Reply With Quote
  #4  
Old   
Michael Collins
 
Posts: n/a

Default Re: Form input - 12-28-2003 , 05:08 PM



JPGREENASSOC wrote:
Quote:
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.
JP,

More info needed. When did the error come up?

Can you copy and paste the exact code here?

Mike



Reply With Quote
  #5  
Old   
LawyerKill
 
Posts: n/a

Default Re: Form input - 12-29-2003 , 06:45 PM



Quote:
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.



Reply With Quote
  #6  
Old   
Michael Collins
 
Posts: n/a

Default Re: Form input - 12-29-2003 , 08:03 PM



LawyerKill wrote:
Quote:
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.
Put both statements

THISFORM.ddate = THISFORM.txtDate.Value
? THISFORM.ddate

in the command button click.

Mike



Reply With Quote
  #7  
Old   
LawyerKill
 
Posts: n/a

Default Re: Form input - 12-30-2003 , 07:26 AM



Quote:
Put both statements

THISFORM.ddate =3D THISFORM.txtDate.Value
? THISFORM.ddate

in the command button click.

Mike
LK

Worked, thanks a lot mike.


Reply With Quote
  #8  
Old   
Michael Collins
 
Posts: n/a

Default Re: Form input - 12-31-2003 , 08:29 AM



LawyerKill wrote:
Quote:
Put both statements

THISFORM.ddate = THISFORM.txtDate.Value
? THISFORM.ddate

in the command button click.

Mike

LK

Worked, thanks a lot mike.
Not that you can't put the statements in other places, but the first step is to get *something* working. ;-)

ps LawerKill, are you JPG, or did you just have the same question?

Mike



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.