Go Back   Forum Care Forums > Development Reference Area > Visual Basic

Reply
 
LinkBack Thread Tools Display Modes
Loading and unloading forms
Old
  (#1)
Geoff
Guest
 
Posts: n/a
Default Loading and unloading forms - 06-04-2007, 10:32 AM

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 p*** 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


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: Loading and unloading forms
Old
  (#2)
Steve Gerrard
Guest
 
Posts: n/a
Default Re: Loading and unloading forms - 06-04-2007, 10:32 AM


"Geoff" <EMAIL REMOVED> wrote in message
news:_EMAIL REMOVED...
> 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 p*** 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



   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: Loading and unloading forms
Old
  (#3)
Antony Clements
Guest
 
Posts: n/a
Default Re: Loading and unloading forms - 06-04-2007, 10:33 AM

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" <EMAIL REMOVED> wrote in message
news:_EMAIL REMOVED...
> 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 p*** 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
>
>



   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top