Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Loading and unloading forms

Question posted by: Geoff (Guest) on November 5th, 2006 07:25 PM
VB6. When selecting from drop down menu options I display different forms by
using the Load (filename) and leave the form with Unload(Filename)



The Load event allows me to program the opening of a particular direct
access file and the Unload event lets me program the closing of the file.
Things are kept 'tidy' this way.



My problem is that I want to pass in a parameter when a particular form
loads. This will control which record is to be displayed. I want Pointer
to come in as a parameter.



Eg Seek #1, Pointer

Get #1, , MembRec



How do I do this?

Your help is appreciated



Geoff


Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Steve Gerrard's Avatar
Steve Gerrard
Guest
n/a Posts
November 5th, 2006
07:35 PM
#2

Re: Loading and unloading forms

"Geoff" <gfriar@freenetname.co.ukwrote in message
news:_LadnftESINv1tPYRVnygQ@brightview.com...
Quote:
Originally Posted by
VB6. When selecting from drop down menu options I display different forms by
using the Load (filename) and leave the form with Unload(Filename)
>
The Load event allows me to program the opening of a particular direct
access file and the Unload event lets me program the closing of the file.
Things are kept 'tidy' this way.
>
My problem is that I want to pass in a parameter when a particular form loads.
This will control which record is to be displayed. I want Pointer to come in
as a parameter.
>


I would create a public method in the target form, and put the file opening code
in that instead. Something like
Public Sub InitForm(Pointer As Long)
' open the file...
' seek for pointer...
' get the data....
End Sub

Then in the menu code of the main form, do
Load frmTarget
Call frmTarget.InitForm(27)
frmTarget.Show

The parameters can be any type you need.

By the way, you should use FreeFile to get a file handle, not hard-code in #1,
as in
nFile = FreeFile
Open "filename" For Random As nFile
Seek #nFile, Pointer
' etc




Antony Clements's Avatar
Antony Clements
Guest
n/a Posts
December 26th, 2006
10:35 AM
#3

Re: Loading and unloading forms
put the code in a .bas file that way it only has to be coded once rather
than on each form. this will also solve your problem by calling things from
the .bas file on form load.

"Geoff" <gfriar@freenetname.co.ukwrote in message
news:_LadnftESINv1tPYRVnygQ@brightview.com...
Quote:
Originally Posted by
VB6. When selecting from drop down menu options I display different forms
by using the Load (filename) and leave the form with Unload(Filename)
>
>
>
The Load event allows me to program the opening of a particular direct
access file and the Unload event lets me program the closing of the file.
Things are kept 'tidy' this way.
>
>
>
My problem is that I want to pass in a parameter when a particular form
loads. This will control which record is to be displayed. I want
Pointer to come in as a parameter.
>
>
>
Eg Seek #1, Pointer
>
Get #1, , MembRec
>
>
>
How do I do this?
>
Your help is appreciated
>
>
>
Geoff
>
>




 
Not the answer you were looking for? Post your question . . .
182,263 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors