hi
you do not keep the textbox, you keep the loginname.
and USR CANNOT be a global variables as there is not such a thing in C# :)
use somethign like this:
class CurrentUser
{
static string loginname="";
static public string Login{ get{ return loginname;} set { loginname=value;}}
}
then in your auth dialog, after you check that the login/password is correct
you do:
CurrentUser.Login = boxUserName.Text;
after that the login is accesible globally as CurrentUser.Login
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
<ro****@tauex.tau.ac.il> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
This is not such agood idea, as the veriable will not keep the name
after function is through.
note: I call USR from a different form
this is the function:
private void btnOK_Click(object sender, EventArgs e)
{
DAL dal= new DAL();
if (dal.userExists(boxUserName.Text,
Int32.Parse(boxPassword.Text))==true)
{
this.DialogResult = DialogResult.OK;
}
else
MessageBox.Show("Wrong username or password. Please try again or open
new user");
USR=boxPassword.Text.ToString();.Text.ToString();
}
tried it and it wasn't useful.
P.S: USR is global variable.