473,385 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Heresy ?


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 ?
Nov 21 '05 #1
3 886
"Barret Bonden" <ar****@networks-cc.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
If your trying to get information OUT of a form, you may want to look at
RAiSEEVENT. Your other form can subscribe to the event & it wont cause
heart aches if you have multiple instances of publishers & subscribers.
http://msdn.microsoft.com/library/de...RaiseEvent.asp
"Barret Bonden" <ar****@networks-cc.com> wrote in message
news:30*************@uni-berlin.de...

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 ?

Nov 21 '05 #3
> 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.
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

30
by: Adam Siler | last post by:
i want to display a series of inline, fixed-width DIVs that will wrap into columns - a table, basically. i can do it under Internet Explorer, but the same code under Netscape or Opera does not...
3
by: guy | last post by:
Could we have an outlining style option to hide comments? When I look at historic code the comments are often plain wrong (cos they are not maintained) and lead to incorect understanding of the...
4
by: Moogy | last post by:
I'm pulling my hair out here. First, I'm new to XML, so that doesn't help, but none of this makes any sense to me. All I'm trying to do is take a simple source XML file and translate it with an...
1
by: glennpierce | last post by:
Hi I was wondering if anyone knows of a method to achieve the creation of events in c. currently I use a function pointer to call one callback. However, I really need to map the function pointer or...
9
by: Frankie | last post by:
I need to provide reports for number of page requests, etc made to an internal company Web site (available only on our Intranet). I have seen various hosting providers making available reports that...
21
by: CoffeeGood | last post by:
Hi folks, I have a 64-bit machine and on this machine I want to run an old program that was written to assume that longs are 32 bits. I've discovered however that gcc on this machine...
59
by: Anando | last post by:
Hi, I have a linear singly linked list of 100 elements. I would like to prune it such that only user specified elements (say only the elements 1, 13, 78 and 100 of the original list) survive...
142
by: jacob navia | last post by:
Abstract -------- Garbage collection is a method of managing memory by using a "collector" library. Periodically, or triggered by an allocation request, the collector looks for unused memory...
157
by: Nomad.C | last post by:
Hi I'm coding this simple program, but I get a segmentation fault, I'm pretty sure that the arrays are big enough and there isn't really any buffer overflows so why is this happening? Program...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.