gberg927
gberg927

Reputation: 1686

VB6 form_load pass parameters

I want to pass a parameter to another form using to the form_load method.

For example,

Private Sub Form_Load(ByVal type as integer)

End Sub

Unfortunately, an error occurs when I type this.

Any ideas?

Upvotes: 1

Views: 4536

Answers (3)

dxb1230
dxb1230

Reputation: 11

you do the otherway around

declare a function that takes a form as a parameter and use that;-)

public sub mbox(msg as String, frm as Form)
  frm.label1.caption = msg
end Function

Upvotes: 1

Deanna
Deanna

Reputation: 24253

Another option is a "constructor" method that takes the parameters you want and calls Me.Show. The method can then be called instead of CustomForm.Show in the other module.

Upvotes: 4

gbianchi
gbianchi

Reputation: 2138

Yes, you can't :)

But you can load the form, then fill public variables on the form, and then call a sub that you make, or do the processing in the form_show

Upvotes: 3

Related Questions