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 / April 2005

Tip: Looking for answers? Try searching our database.

How can share the value between more  Windows Forms ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kylin - 04 Apr 2005 08:18 GMT
hi,
Where the user input there Login Name and Password,
and I want to remerber this values In maninform,
and this values will be used by other form,
eg: Change password Form,
this need the user's name ,oldpassword, new password,
and the user's name comes from the mainform.

how can do for this ?

Signature

FireCrow Studio
Kylin Garden
EMail:w0wd@sohu.com
ICQ:156134382

Danny T - 04 Apr 2005 08:34 GMT
> hi,
> Where the user input there Login Name and Password,
[quoted text clipped - 5 lines]
>
> how can do for this ?

You could use properties, or parameters in the constructor. eg.

-- loginForm.cs --
MainForm frm = new MainForm(txtUser.Text, txtPass.Text);
frm.Show()
-- / --

-- MainForm.cs --
public MainForm(string user, string pass)
{
    // Put user & pass into private fields
}
-- / --

Or alternatively, add some properties, so you can do

-- loginForm.cs --
MainForm frm = new MainForm();
frm.User = txtUser.Text;
frm.Pass = txtPass.Text
frm.Show()
-- / --

Though if you're doing it that way, a struct to hold the details might
be better:

-- loginForm.cs --
MainForm frm = new MainForm();
frm.UserDetails = new UserDetails(txtUser.Text, txtPass.Text);
frm.Show()

struct UserDetails
{
    public string User, Pass;
    public UserDetails (string user, string pass)
    {
        User = user;
        Pass = pass;
    }
}
-- / --

HTH

Signature

Danny


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.