VB6 - Form1.Show, it is a method? Show is not on the Form Properties nor the Form Event Code. What is SHOW? Can I add code to it?

Thanks

I understand what SHOW does. I want the terminology of what it is. In Visual FoxPro, both SHOW and LOAD were considered event methods and they both gave the programmer the ability to add custom code. VB only allows me to add custom code to LOAD. So ... I am wondering what is SHOW if it is not an Event Method.

Object Browser within VB6 says:

Sub Show([Modal], [OwnerForm])
Member of VB.Form
Displays an MDIForm or Form object.

Event Load()
Member of VB.Form
Occurs when a form is loaded.

Say (for example's sake) I have a form called frmMainWindow.
I want to open the form as it is and display it onscreen, so I would do

frmMainWindow.Show

I can make it modal (i.e. it becomes the foremost window of the VB application I created by doing

frmMainWindow.Show vbModal

instead.

Now, if I had the same form (frmMainWindow), but wanted to pass some information into the form which I intend on using when displaying the form onscreen (and the data controls on it for example), I would first load the form

Load frmMainWindow

and then I would have exposed the public properties/subs/functions within the form so I can use them where I am.
Example:

Load frmMainWindow
frmMainWindow.ExampleProperty = "blah"
frmMainWindow.ExampleSub
bTest = frmMainWindow.ExampleFunction("info",1)
frmMainWindow.Show vbModal

There, I have loaded the form into memory, then used an example property, sub and function before displaying the form using .Show

I hope that has helped? If I have just pretty much repeated what you already knew, then I apologise :)

This article has been dead for over six months. Start a new discussion instead.