Hi everybody,
The following code runs fine util the commented lines. The debugger halts and sends me a message saying that "custView is a variable and is being used as a method". Can anyone shed some light on this? Thank you very much.
Best regards,
JC :)
--------------------------------------------------------------------------
private void btnLogin_Click(object sender, EventArgs e)
{
System.Data.DataView custViewLogin = new System.Data.DataView(SASCRDataSet.tabUsers, "", "Login", System.Data.DataViewRowState.CurrentRows);
System.Data.DataView custViewPassword = new System.Data.DataView(SASCRDataSet.tabUsers,"", "Password", System.Data.DataViewRowState.CurrentRows);
int rowIndexLogin = custViewLogin.Find(this.txtUserName.Text);
int rowIndexPassword = custViewPassword.Find(this.txtPassword.Text);
if (rowIndexLogin == -1 || rowIndexPassword == -1)
{
MessageBox.Show("Usuário ou Senha inválida. \r" + "Por favor tente de novo. ", "Acesso negado ...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
this.txtPassword.Focus();
this.txtPassword.Text = "";
CTM = CTM + 1;
if (CTM == TRYMAX)
{
MessageBox.Show("Você usou o nº máximo de tentativas \r" + " de login e está sendo desconectado \r" + " por motivos de segurança! ", "Acesso bloqueado ...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
Application.Exit();
}
}
else
{
//---------------- This is where the problems starts---------------
this.UserRealName.Text = custViewLogin(rowIndexLogin)("UserRealName").ToString();
this.AccessRights.Text = custViewLogin(rowIndexLogin)("AccessRights").ToString();
//---------------- This is where the problems finishes---------------
Form frmMain = new frmMain();
frmMain.Show();
this.Hide();
}
}