A Few questions about Programming VFP6 
Author Message
 A Few questions about Programming VFP6

 I am a newbie to FoxPro although have been learning quite a bit lately.
 I'm working in VFP6 and I have the Programmer's Guide and the Language
Reference.  Both of which have taught me a lot.  The problem is unless I
read it all cover to cover (and fall asleep)  I don't know what exists
or what to look up.

I will be creating an executable when I am done.  My project is pretty
simple.  Just a form or two and and a couple of programs. It just needs
to read existing data on my clients machine and create a text file with
it. Rather than hard code in the location of his data, I would like to
get this from him on first run and store it to use each time.

Questions:
Where do I store this info and how do I read it at run time?

When I request the file location from the user would I do this via a
form?  Can I have a browse button that will show the directories on his
machine so he can select the location instead of typing it into a
textbox?

I'm using FCREATE to create the text file and if the program is
interupted before the FCLOSE I have to CLOSE ALL before I can run the
program again. OR I have to DISPLAY STATUS to find the HANDLE and then
FCLOSE(HANDLE)  Is there a FUNCTION that returns the HANDLE of files
opened with FCREATE, so that my program can do this automatically?  Or a
command that will CLOSE thise file without having to CLOSE ALL?

Another little question.  When setting a varibale to a string, is there
a character that I can insert that will force a line feed?  So for
example, if I want to have a messagebox with a little blurb and then
insert a couple of line feeds before the important question so that it
is easier to read.  What would be the correct syntax?

If anyone can tell me exactly how to do these things, great.  Otherwise
pointing me in the right direction would really help.

Thanks.

--
Jennifer
--
MAH Designs(tm) - http://www.*-*-*.com/
No More 9-5(tm) - http://www.*-*-*.com/

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Thu, 18 Jul 2002 03:00:00 GMT  
 A Few questions about Programming VFP6
Jennifer,

Quote:
> Where do I store this info and how do I read it at run time?

You can store it in a dbf and put the alias.fieldname in the
controlsource property of the textbox

Quote:
> When I request the file location from the user would I do this via a
> form?  Can I have a browse button that will show the directories on his
> machine so he can select the location instead of typing it into a
> textbox?

look at the getdir() command (in the button click
thisform.textdir.value=getdir())

Quote:

> Another little question.  When setting a varibale to a string, is there
> a character that I can insert that will force a line feed?  So for
> example, if I want to have a messagebox with a little blurb and then
> insert a couple of line feeds before the important question so that it
> is easier to read.  What would be the correct syntax?

> If anyone can tell me exactly how to do these things, great.  Otherwise
> pointing me in the right direction would really help.

Use the chr(13) in the messagebox or the wait window

Quote:
> Thanks.

You're welcome

HTH
--
Fred - Armoni (France)
The Sky Is Crying



Thu, 18 Jul 2002 03:00:00 GMT  
 A Few questions about Programming VFP6


Quote:
> I am a newbie to FoxPro although have been learning quite a bit lately.
>  I'm working in VFP6 and I have the Programmer's Guide and the Language
> Reference.  Both of which have taught me a lot.  The problem is unless I
> read it all cover to cover (and fall asleep)  I don't know what exists
> or what to look up.

> I will be creating an executable when I am done.  My project is pretty
> simple.  Just a form or two and and a couple of programs. It just needs
> to read existing data on my clients machine and create a text file with
> it. Rather than hard code in the location of his data, I would like to
> get this from him on first run and store it to use each time.

> Questions:
> Where do I store this info and how do I read it at run time?

> When I request the file location from the user would I do this via a
> form?

You can but it's not a necessity

Quote:
> Can I have a browse button that will show the directories on his
> machine so he can select the location instead of typing it into a
> textbox?

just use GETFILE() it's very easy

Quote:
> I'm using FCREATE to create the text file and if the program is
> interupted before the FCLOSE I have to CLOSE ALL before I can run the
> program again. OR I have to DISPLAY STATUS to find the HANDLE and then
> FCLOSE(HANDLE)  Is there a FUNCTION that returns the HANDLE of files
> opened with FCREATE, so that my program can do this automatically?  Or a
> command that will CLOSE thise file without having to CLOSE ALL?

You should use
SET PRINTER TO TEXTFILE.TXT
Then send your data with ???
then you issue a SET PRINTER TO at the end
If the programm is interrupted you don't have to remember the handle

Quote:
> Another little question.  When setting a varibale to a string, is there
> a character that I can insert that will force a line feed?  So for
> example, if I want to have a messagebox with a little blurb and then
> insert a couple of line feeds before the important question so that it
> is easier to read.  What would be the correct syntax?

insert a CHR(13) in your string between your lines.

- Show quoted text -

Quote:
> If anyone can tell me exactly how to do these things, great.  Otherwise
> pointing me in the right direction would really help.

> Thanks.

> --
> Jennifer
> --
> MAH Designs(tm) - http://www.mahdesigns.com/
> No More 9-5(tm) - http://www.NoMore9-5.com/

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Thu, 18 Jul 2002 03:00:00 GMT  
 A Few questions about Programming VFP6

Quote:
> > I'm using FCREATE to create the text file and if the program is
> > interupted before the FCLOSE I have to CLOSE ALL before I can run
the
> > program again. OR I have to DISPLAY STATUS to find the HANDLE and
then
> > FCLOSE(HANDLE)  Is there a FUNCTION that returns the HANDLE of files

Thanks for everyone's help.

Quote:
> > opened with FCREATE, so that my program can do this automatically?
Or a
> > command that will CLOSE thise file without having to CLOSE ALL?

> You should use
> SET PRINTER TO TEXTFILE.TXT
> Then send your data with ???
> then you issue a SET PRINTER TO at the end
> If the programm is interrupted you don't have to remember the handle

How is the speed with this method.  I've built my program from some
sample text that someone offered me and the FWRITE was much quicker than
the method that the other program used.  Although, I can't remember now
how the other program did it. My tables are about 8M

Jennifer

Sent via Deja.com http://www.deja.com/
Before you buy.



Fri, 19 Jul 2002 03:00:00 GMT  
 A Few questions about Programming VFP6
Jennifer,

When you use FCREATE (or FOPEN) it creates a file handle.  Store the
file handle in a PUBLIC variable.  If you have an execution error and
cancel the program without issuing the FCLOSE, you can simply issue the
FCLOSE from the command line using the PUBLIC variable you defined.

Example:

PUBLIC fhandle

fhandle=FCREATE('MyFile.txt')

...

If you abort, then you can simply issue FCLOSE(fhandle) from the command
line.

Rick Ireland



Fri, 19 Jul 2002 03:00:00 GMT  
 A Few questions about Programming VFP6


Quote:

> > > I'm using FCREATE to create the text file and if the program is
> > > interupted before the FCLOSE I have to CLOSE ALL before I can run
> the
> > > program again. OR I have to DISPLAY STATUS to find the HANDLE and
> then
> > > FCLOSE(HANDLE)  Is there a FUNCTION that returns the HANDLE of files
> Thanks for everyone's help.

> > > opened with FCREATE, so that my program can do this automatically?
> Or a
> > > command that will CLOSE thise file without having to CLOSE ALL?

> > You should use
> > SET PRINTER TO TEXTFILE.TXT
> > Then send your data with ???
> > then you issue a SET PRINTER TO at the end
> > If the programm is interrupted you don't have to remember the handle

> How is the speed with this method.  I've built my program from some
> sample text that someone offered me and the FWRITE was much quicker than
> the method that the other program used.  Although, I can't remember now
> how the other program did it. My tables are about 8M

Issue a CLOSE ALL, it also closes low-level files.


Fri, 19 Jul 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. A few Fox Programming Questions

2. program question vfp6

3. VFP - A few questions

4. A few string manipulation questions for Foxpro on Macintosh

5. A few top-level FoxPro questions...

6. A few questions about using an SQL server with VFP

7. A few Questions on VFP 5.0a

8. A few questions...

9. A few more newbie questions...

10. Few VFP3 questions

11. A few Grid Questions

12. A few VFP questions.

 

 
Powered by phpBB® Forum Software