Please don't laugh I'm sincere 
Author Message
 Please don't laugh I'm sincere

I don't expect anyone to go over instructions step by step but I it is
my hope that some kind person will tell me what topics I need to look up
or maybe even where an example my be posted.

I need to learn how to create a file, store the some values in the file,
open the file later, read the values from the file and replace the usual
default values with those.  It's not really organized like a data base
so I'm not sure what other topic search for.

Thanks any assistance,

Judy



Sat, 15 Jan 2000 03:00:00 GMT  
 Please don't laugh I'm sincere

     In the VB help check out Input, Line Input, Print, Write, Get and Put.

Jon Clegg


Quote:
>I don't expect anyone to go over instructions step by step but I it is
>my hope that some kind person will tell me what topics I need to look up
>or maybe even where an example my be posted.

>I need to learn how to create a file, store the some values in the file,
>open the file later, read the values from the file and replace the usual
>default values with those.  It's not really organized like a data base
>so I'm not sure what other topic search for.

>Thanks any assistance,

>Judy



Sat, 15 Jan 2000 03:00:00 GMT  
 Please don't laugh I'm sincere

Quote:

[snip]
> I need to learn how to create a file, store the some values in the file,
> open the file later, read the values from the file and replace the usual
> default values with those.  It's not really organized like a data base
> so I'm not sure what other topic search for.

[...]

Try something on this order:

'Create a file with two records:
    OPEN "MYFILE.DAT" FOR OUTPUT AS #1
    PRINT #1, "Green"
    PRINT #1, "Red"
    CLOSE

'Read the two values from the file:
    OPEN "MYFILE.DAT" FOR INPUT AS #1
    INPUT #1, Color1$
    INPUT #1, Color2$
    CLOSE

This concept should get you started.  Expand upon this, and modify it to
suit your needs.  To learn more, invoke the help function for each key
word.  You may also find examples of similar things in reference
manuals, programmer's guides, etc.  Good luck with your application.

--
Reply Addr:-->WDavid dot Simon at atl dot frb dot org<--



Sat, 15 Jan 2000 03:00:00 GMT  
 Please don't laugh I'm sincere

Quote:

>I don't expect anyone to go over instructions step by step but I it is
>my hope that some kind person will tell me what topics I need to look up
>or maybe even where an example my be posted.

>I need to learn how to create a file, store the some values in the file,
>open the file later, read the values from the file and replace the usual
>default values with those.  It's not really organized like a data base
>so I'm not sure what other topic search for.

>Thanks any assistance,

>Judy

'create original file
open "afile" for output as 1
print #1, "data1"
print #1, "data2"
print #1, "data3"
close 1

'read from the file
open "afile" for input as 1
line input #1, value1$
line input #1, value2$
line input #1, value3$
close 1

'change some of the data
value1$ = "newdata1"
value2$="newdata2"

'save the changed data
open "afile" for output as 1
print #1, value1$
print #1, value2$
print #1, value3$   'this wasn't changed but we have to put it back
close 1

Visit my source code page at http://www.mindspring.com/~johnecarter
Visit my favorite school at http://www.mindspring.com/~addison

Get PR-Tracker -- tracks problem reports, defects, bugs
INFORMATION:  http://www.prtracker.com/info.html
DOWNLOAD:     http://www.prtracker.com/download.html



Sun, 16 Jan 2000 03:00:00 GMT  
 Please don't laugh I'm sincere

Hi Judy,


Quote:
> I don't expect anyone to go over instructions step by step but I it is
> my hope that some kind person will tell me what topics I need to look up
> or maybe even where an example my be posted.

> I need to learn how to create a file, store the some values in the file,
> open the file later, read the values from the file and replace the usual
> default values with those.  It's not really organized like a data base
> so I'm not sure what other topic search for.

If you can store it in a INI type file, you can use the
GetPrivateProfileString API call to read the values and the
SetPrivateProfileString to set them.

Try searching the Micro$oft Knowledge Base for examples:
http://www.microsoft.com/kb

I hope this helps.
--

Remove last "x" to send non-spam email



Sun, 16 Jan 2000 03:00:00 GMT  
 Please don't laugh I'm sincere

Another method I would consider is using some of the windows API functions
for dealing with .INI files.  You can store values under different
headings, and these functions will automatically look up and retrieve
values for you.  The API functions you would probably be interested in
would be:

GetPrivateProfileString
GetPrivateProfileInt
WritePrivateProfileString

I believe VB comes with some help for API functions.  If not, I am quite
sure that the VB Knowledge Base has sufficient information.  Sorry I am not
sure where to get it though...  It sounds like these functions would have a
few benefits for your application which would make things easier:
1)  It will automatically create the file for you, if it does not exist.
2)  You can specify default return values for the functions, if the value
you are looking up does not exist.  This way you wouldn't have to worry
about setting defaults, looking up a value, and replacing with the
defaults.  You could just pass the API function a default value and use
whatever it returns, default or other.
3)  You don't have to worry about searching the file for the values.

I have used these functions extensively for remembering user selections in
my applications.  These functions are quite useful in setting up a "poor
man's database".  The only limitation I am aware of for these functions, is
that they cannot handle files larger than 64k.  This has never been a
problem for me though!

Hope this helps.

Duane


Quote:
> I don't expect anyone to go over instructions step by step but I it is
> my hope that some kind person will tell me what topics I need to look up
> or maybe even where an example my be posted.

> I need to learn how to create a file, store the some values in the file,
> open the file later, read the values from the file and replace the usual
> default values with those.  It's not really organized like a data base
> so I'm not sure what other topic search for.

> Thanks any assistance,

> Judy



Tue, 18 Jan 2000 03:00:00 GMT  
 Please don't laugh I'm sincere

Hey there! a Good idea is to look into Random Access files. They allow
you to values into a structure and then place it into a file. you can
then retrieve it later anytime youi want. Topics to look for in VB
are:

                PUT statemrent
                GET statement
                Random access files
                structures

                        Dave

Quote:
>I don't expect anyone to go over instructions step by step but I it is
>my hope that some kind person will tell me what topics I need to look up
>or maybe even where an example my be posted.

>I need to learn how to create a file, store the some values in the file,
>open the file later, read the values from the file and replace the usual
>default values with those.  It's not really organized like a data base
>so I'm not sure what other topic search for.

>Thanks any assistance,

>Judy



Fri, 21 Jan 2000 03:00:00 GMT  
 Please don't laugh I'm sincere

Looks like the OPEN, WRITE,CLOSE then OPEN,INPUT,CLOSE examples that
others have posted will be enough.

If not and you really want some File I/O see my post on the subject.

Jeff

How we gallants come to the rescue of a Lady :-)



Sat, 22 Jan 2000 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Please don't laugh...

2. Please Don't Laugh!

3. Please Don't Laugh!

4. Ok Ok Don't laugh :)

5. Winsock Email (don't laugh)

6. Don't laugh at that one

7. Art and all that Jazz: let's laugh about the shallow cafes, but don't like the humble barbers

8. Don't laugh OK, I'm still in school.

9. Don't understand 'Set'

10. Why don't my exe's and ocx's unregister

11. please don't laugh, is this code ok?

12. PLEASE, DON'T BE STUPID!!

 

 
Powered by phpBB® Forum Software