Help saving VB APPS in Win edition 
Author Message
 Help saving VB APPS in Win edition

How do I use random access so users can save their program.  I want visual
basic to saves the varabiles and then later when the users want to load a
program VB loads the varabels into memory.  I am a VB beginer using VB 3.0
for Windows.  Standerd edition.  Please use understandable terms for a VB
beginner.

           Example:  Varable "HP" is 43 and varable "GP" is 341123.
                                User saves and quits the program****
                                User loads the program****
                                HP and GP are what they were before****

****  How do I do this step

Thanks



Tue, 26 Aug 1997 09:32:02 GMT  
 Help saving VB APPS in Win edition

Quote:

>How do I use random access so users can save their program.  I want visual
>basic to saves the varabiles and then later when the users want to load a
>program VB loads the varabels into memory.  

One common method for doing this is to save the information in the INI file.  If
you open your VB group and click on the Knowledge Base icon, you'll find all
kinds of helpful stuff in here.  (There's also a better version of this
available; you get it at ftp.microsoft.com/SoftLib/MSLfiles/vbkb_ft.exe.)  
Anyway, click on Programming Issues and look for the article that's titled "How
to Access Windows Initialization Files from Within Visual Basic (Q75639).

--

Systems Analyst         WWW:    http://www.phoenix.net/USERS/getj



Tue, 26 Aug 1997 12:27:31 GMT  
 Help saving VB APPS in Win edition

Quote:

> How do I use random access so users can save their program.  I want visual
> basic to saves the varabiles and then later when the users want to load a
> program VB loads the varabels into memory.  I am a VB beginer using VB 3.0
> for Windows.  Standerd edition.  Please use understandable terms for a VB
> beginner.
>            Example:  Varable "HP" is 43 and varable "GP" is 341123.
>                                 User saves and quits the program****
>                                 User loads the program****
>                                 HP and GP are what they were before****

First look at the on line help for the commands Open, Close, Put, Get, Len.
Heres a quick example:
First declale a user defined type(again look that up in the on line
help), that contains the fields you want to save.

Type  SavedInfo
   HpSaved As Integer 'or what ever type HP is, when using strings make
                        sure they are FIXED length, ie HpSaved As String*5
   GpSaved As Integer
End type

Now on form exit, or where ever it is appropriate
Form_Unload()
   Dim RecordLen As Long
   Dim Info As SavedInfo
'Calculate the length of each record you store(your user defined type length)

RecordLen = Len(Info)
'get the information to store
Info.HpSaved = HP
Info.GpSaved = GP
'Open the file, note this is a very quick example, you should provide
'code to handle errors..
Open "FileName with Path" for Random As #1 Len = RecordLen
Put #1, RecordNumber, Info
'close the file
Close   'a close with no arguments closes ALL open files.
End Sub

If you combine this with the cmdialog vbx, you can provide an easy way
form multiple users to save their work, form setup....
This way is a bit better then using the ini file. Because you can let
the user save the info to a specific file.  Look up the above
mentioned commands and it will seem alot clearer.
----------------------------------------------------------------------
Greg Carter
4th year Electrical Engineering
Carleton University


Take a look at my home page on the
World Wide Web: http://chat.carleton.ca/~gcarter
----------------------------------------------------------------------



Wed, 27 Aug 1997 03:37:26 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Win API Call not working in vb.net app distributed to WIn 98

2. VB 6 Ent Editions & Win 2K

3. Help: Keystrokes fm win app to dos app

4. QUESTION.....How to play midi files in VB 4.0 Standard Edition for win 95

5. VB 6.0 Professional Edition won't install

6. please help: VB app with ADODC won't work at Win98

7. VB 4 app doesn't want to run under Win 3.x Help Please

8. VB 5.0 Professional Edition Vs. VB 5.0 Enterprise Edition

9. VB App won't exit -- HELP!

10. Win 95B - Running 16 bit VB Apps - help

11. vb dotNet Learning Edition on XP Home Edition??

12. VB Enterprise Edition vs. Professional Edition

 

 
Powered by phpBB® Forum Software