Bernie,
You want to share a function between two forms.
That the function is now on form1 is in my idea from not any importancy.
It can be a good reason to make a shared class as this function has as well
data in it.
If it has not data than it is bettter just to instance it when it is needed.
Therefore we get something as
Class Form1 etc
Sub Whatever
MyHelperClass.m yStatus = true
end sub
Class Form2 ect
Sub Whatever
dim status = myHelperClass.M yStatus
end sub
Public Class myHelperClass
public shared MyTogle as boolean
Public Shared property MyStatus() as boolean
Get
return MyTogle
End Get
Set(byval value as boolean)
myTogle = value
End Set
End Class
I hope that this gives an idea
Cor
"Bernie Hunt" <bh***@optonlin e.net> schreef in bericht
news:Xn******** *************** ********@207.46 .248.16...
Cor,
I understand and your point makes alot of sense. The basic problem will
still exist in your suggested design.
The problem is I'm having trouble accessing a function in an instatiated
form. Please see the code I posted in my other message. I show the exact
problem there.
If I can get past the amazinly simple syntax problem, then I can worry
about better design, hahahaha.
Bernie
"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in
news:eM******** *****@TK2MSFTNG P03.phx.gbl:
Bernie,
It is not impossible. However you would try to avoid it. It can make
your project completely dependend from form2. If you change something
in that than you have forever to think that it can have effects on
form1. And with that ending one of one of the major reasons of OOP.
Maintainability .
You should not try to do things in your class Form2, which are done in
Form1. Create than a special class for that, which you can use in
both.
Just my thought,
Cor
"Bernie Hunt" <bh***@optonlin e.net> schreef in bericht
news:Xn******** *************** ********@207.46 .248.16... This is probably a silly question, but I've gotten myself confused.
My app has two forms, form1 and form2. form1 is the start up object
in the propers. An event in form1 instantiates form2.
Dim myForm as HardwareStore
myForm = New HardwareStore
myForm.Show()
I understand that my form2 can be referenced by
myForm.blah
What is the form name for form1 so that I can reference it from form2
(myForm)?
form1.blah
Doesn't work.
Sorry for such a basic question, but I'm trying to learn here,
hahaha.
Bernie