Vgolfmaster said:
1 more follow up please....
just for kicks, I simply entered 'Me.text = "new text" under the button
click event, and it worked! I just don't know why.....
Being under the button click event, shouldn't that have changed the text of
the button? Or does it default to the form property/object unless you code it
elsewhere? I was assuming I had to instantiate the forms title bar object to
access the text, but obviously this was an incorrect assumption. It at least
appears that in a click event for button1 that:
me.text refers to the form
me.button1.text refers to the buttons text
I would have thought the exact opposite, and obviously that is where I was
wrong! I assumed that
me.text would apply to the buttons text -and-
me.frmBuying.text was needed to access the forms
Live and learn, I guess!
V
'Me' points to an instance of the class that contains 'Me'. So, if it's
inside Class frmBuying, Me points to an instance of class frmBuying.
If Button1 is a field (a variable at class level, i.e. outside all
procedures), you refer to it by writing "Me.Button1".
'Me' is (usually) optional because the compiler resolves names inside
out, i.e. first it looks at the local variables and arguments, then at
class level. So, writing
Text="new text"
is the same as
Me.Text="new text"
and
Button1.text="new text"
is equal to
Me.Button1.text="new text"
One excpetion where you do need 'Me':
class MyForm
Inherits Form
sub MySum()
dim Text as string
text = "local" 'Changes local variable
me.text = "class level" 'Changes Form property
end sub
end class