disabling button after login
Oct 16, 2010 at 10:42am UTC
hi i want to have a button disabled at runtime after a user login with certain credentials.can someone please point me in the right direction?
Oct 17, 2010 at 10:23am UTC
if(...)
somebutton.enable=false;
Oct 20, 2010 at 4:19am UTC
Some_Btn.EnableWindow(FALSE);
Oct 20, 2010 at 4:16pm UTC
How are you drawing said button?
What type of login system have you implemented/need to implement?
Oct 22, 2010 at 4:27am UTC
thank you guys for the reply. i have a txt file with some user credentials eg. admin and user. should admin login he will have say 3 buttons available, should user login he should have say only two buttons available. I have commented out where i am trying to call the form which should have the said button disabled. Here is some of my code. thanks for your assistance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
for (int i = 0; i < Count; i++)
if ((strUser == U[i].Name) && (strPword == U[i].Password))
{
Accept = true ;
break ;
}
if (Accept)
{
MessageBox::Show("Welcome to ..." , "Welcome" , MessageBoxButtons::OK, MessageBoxIcon::Information);
this ->Hide();
MainLect2GUI ^mForm = gcnew MainLect2GUI();
mForm->ShowDialog();
// mForm->btnViewLect->IsDisposed();
this ->Visible = true ;
txtUser->Clear();
txtPass->Clear();
}
else {
MessageBox::Show("Invalid attempt" ,"Error" , MessageBoxButtons::OK, MessageBoxIcon::Information);
if (txtUser->Text != "" )
{
txtPass->Text = "" ;
txtPass->Focus();
}
else
{
txtUser->Text = "" ;
txtUser->Focus();
}
Count++;
txtUser->Clear();
txtPass->Clear();
txtUser->Focus();
}
while (!Accept)
{
if (Count == 3){
MessageBox::Show("Too many failed attempts" ,"Error" , MessageBoxButtons::OK, MessageBoxIcon::Information);
}
break ;
this ->Close();
}
Topic archived. No new replies allowed.