Heresy ?

  • Thread starter Thread starter Barret Bonden
  • Start date Start date
B

Barret Bonden

Heresy ?



I successfully and simply passed data from one form to another. (this
after days of frustration at the methods I read of and that felt to me to be
verbose and over exact)



I created a public variable with :

Public shared v as string (shared being the key, I suspect)



And on another form having created a copy of the first (with the variable v
in it)

Dim f2 as new form1

Textbox1.text=f2.v



Have I committed heresy ? Am I bound for OO purgatory ? Or if not a symbolic
(NPI) crime, are there any real negative ramifications to using such
variables commonly ?
 
Barret Bonden said:
Heresy ?
?!?

I successfully and simply passed data from one form to another. (this
after days of frustration at the methods I read of and that felt to me to
be
verbose and over exact)



I created a public variable with :

Public shared v as string (shared being the key, I suspect)

You'll ger into trouble if there is more than one instance of the form and
each of the instances should have its own 'v'. Instead of using a shared
variable a public property of the form + passing references to form
instances might be the preferred way.
 
Have I committed heresy ? Am I bound for OO purgatory ? Or if not a symbolic
(NPI) crime, are there any real negative ramifications to using such
variables commonly ?

Well, you are going straight to hell actually. The right thing to do
is to create your own class that has data that may be shared among
multiple forms. Instantiate that object when your application first
starts and have it live as a static. As an added benefit, you can do
groovy things like have multiple different forms pointing at the same
data, and changing it. If you build in a good event handling
mechanism, then you can have all of your forms updating when you
change on form.
 

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