Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2005

Tip: Looking for answers? Try searching our database.

User interface

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ChrisB - 11 Feb 2005 19:45 GMT
How would I code a program to take information entered in a text box on
a form and use it or a pointer to use the information in a different
part of the program?
Herfried K. Wagner [MVP] - 11 Feb 2005 19:52 GMT
"ChrisB" <ChrisB@spam.net> schrieb:
> How would I code a program to take information entered in a text box on a
> form and use it or a pointer to use the information in a different part of
> the program?

Simple solution:

\\\
Friend Module Data
   Public UserName As String
   ...
End Module
.
.
.
Data.UserName = Me.UserNameTextBox.Text
.
.
.
MsgBox(Data.UserName)
///

Alternatively you can use the Singleton design pattern to implement
something similar to that shown above.  If your forms' instances are always
kept alive, you can pass references to the forms containing the data around
in order to be able to access the data stored by the form.

Signature

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

Tim Wilson - 11 Feb 2005 20:21 GMT
If I'm understanding the question correctly, I guess it comes down to how
the information is to be shared with the rest of the application. There are
at least two options. One is to create a custom event and another is to
create a custom property on the Form. If another Form needs to be notified,
information "push", when something has happened then you would use an event,
if another Form is going to "pull" the information out then a property would
be best. So if the whole idea is to allow a user to enter information into a
TextBox and then have this information exposed on another Form, then look
into a property. Or, if the information is vital to the data on the other
Form, then you might even want to create a constructor (sub New in VB) that
requires this information.

Signature

Tim Wilson
.Net Compact Framework MVP

> How would I code a program to take information entered in a text box on
> a form and use it or a pointer to use the information in a different
> part of the program?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.