467,880 Members | 1,149 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,880 developers. It's quick & easy.

Loading and unloading forms

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
Nov 5 '06 #1
  • viewed: 8363
Share:
2 Replies

"Geoff" <gf****@freenetname.co.ukwrote in message
news:_L********************@brightview.com...
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

Nov 5 '06 #2
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" <gf****@freenetname.co.ukwrote in message
news:_L********************@brightview.com...
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


Dec 26 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Wayne Wengert | last post: by
5 posts views Thread by vineeth | last post: by
6 posts views Thread by Pete Davis | last post: by
4 posts views Thread by John | last post: by
2 posts views Thread by Rob | last post: by
3 posts views Thread by Eric A. Johnson | last post: by
1 post views Thread by Geoff | last post: by
6 posts views Thread by ernesto.tejeda | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.