Reputation: 1
I am new in c# and i have a trouble with my app.
I Had 2 forms (1º and 2º) called Login and Checkuser, and i need to hide Login form when Checkuser checks a correctly login.
I tried with this from Checkuserform:
Login Loginform = new Login();
Loginform.Hide();
but it doesn't works, so i tried other way but i cant make it work. i set a int on Login form called Hider = 0. So, when checker checks a correctly user, the Hider will be 1, then in Login form when check the value of Hider and it is 1, the form will hide.
//In Login form
public int Hider = 0;
//Checker of Loginform constantly run so when hider change to 1, it should hide
if (Hider == 1) { this.Hide(); }
//In Checkuser form
//When user login correctly
Login Loginform = new Login();
Loginform.hider = 1;
But it doesn't work, the hider value continues with 0, it not change. I had other code with strings values, but from Login to Checkuser and it works correctly, but when i try make the same with int but from Checkuser to Login (With the hider) it doesnt work.
I need help to fix this problem. And sorry for my english haha. Thank you, regards.
Upvotes: 0
Views: 75
Reputation: 6420
//In Login form
public int Hider = 0;
//Checker of Loginform constantly run so when hider change to 1, it should hide
if (Hider == 1) { Loginform.Hide(); }
//In Checkuser form
//When user login correctly
Login Loginform = new Login();
Loginform.hider = 1;
this
function only talks about the context area in which it is defined , in this case login form and you are using it implicitly in checkuser form.
try changing this.Hide()
to Loginform.Hide()
, hope it may now work.
Upvotes: 1