Hi,
I'm having trouble with variable scope inside procedures.
this is pseudocode
LDAP NewUser;
if (something = true)
{
NewUser = LDAP.FindUser(use emailaddress)
this.textbox1 = NewUser.name
}
else
{
NewUser = LDAP.FindUser(use employeeID)
this.textbox1 = NewUser.name
}
I'd rather have this:
if (something = true)
{
NewUser = LDAP.FindUser(use emailaddress)
}
else
{
NewUser = LDAP.FindUser(use employeeID)
}
this.textbox1 = NewUser.name
however: i get the error unassigned use of NewUser. How do I declare NewUser
so that I can have access to its members outside of the if..else statement?
my real code has dozens of textboxes to fill and I don't want to duplicate
the same
statments twice.
thanks
chris