You check for "Admin" but what if it was typed in as "admin", "ADMIN", "AdMiN" or any other combination?
According to the documentation for
String.Equals
:
This method performs an ordinal (case-sensitive and culture-insensitive) comparison.
public int m = 0;
string user = Usernametxt.Text.ToLower;
if (user.Equals("admin"))
{
m = 1;
}
else { m = 0; }
Also, don't you have to use ShowDialog to display the login form?
Loginfrm objLoginfrm = new Loginfrm();
objLoginfrm.ShowDialog;
if (objLoginfrm.m==1)
{
...