me

  • Thread starter Thread starter Saber
  • Start date Start date
S

Saber

How can I pass *me* as an arguman to a function?
I want to modify form's maximizebox, backgroundimage, etc within a module.

Thanks
 
modules can't use me only instances.

otherwise you make an argument in the function that is the same object type
as the me'd object.
 
Saber said:
How can I pass *me* as an arguman to a function?
I want to modify form's maximizebox, backgroundimage, etc within a module.

Depending on whether the procedure in the module is designed to work on
any Form, or just forms of one particular type, you would write it as:

Public Sub DoStuffToForm(ByVal f As Form)
f.MaximizeBox = 'whatever

or

Public Sub DoStuffToForm(ByVal f As FMyFormType)
f.MaximizeBox = 'whatever


Either way you would call it from the form with

DoStuffToForm(Me)
 
Byval with a reference type variable allows you to modify the object to
which the the reference points

e.g.

Sub SetText ( byval frm as Form)

frm.Text = "Hello"

End

so the example above is fine.


ByRef with a reference type will allow you to refer it to another
object


Sub GetForm( byref frm as Form)

frm = new Form

end sub


hth,
Alan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top