private void btnOK_Click(object sender, EventArgs e) { try { string sqlstr = "SELECT * FROM loginDetails WHERE username = '******' "; DataSet ds = m1.selectData(sqlstr); if (ds.Tables[0].Rows.Count > 0) { string username = Convert.ToString(ds.Tables[0].Rows[0]["username"]); string password = Convert.ToString(ds.Tables[0].Rows[0]["password"]); if (tbUserName.Text != username || tbPassword.Text != password) { MessageBox.Show("Please enter valid credentials!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { this.Hide(); SelectFirm companySelect = new SelectFirm(); companySelect.Show(this); } } else { MessageBox.Show("Please enter valid credentials!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception e1) { MessageBox.Show("Error :" + e1.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void tsmiCompanyInfo_Click(object sender, EventArgs e) { SelectFirm selection = new SelectFirm(); selection.ShowDialog(); lbSelectedCompany.Text = BaseModel.Instance.SelectedCompany; lbFinancialYear.Text = BaseModel.Instance.FinancialYear; tabMain_SelectedIndexChanged(null, null); }