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