private void food_Click(object sender, EventArgs e) { MenuFood food = new MenuFood(); this.Hide(); food.ShowDialog(); }
private void loginBtn_Click(object sender, EventArgs e) { if (txtpassword.Text != string.Empty || txtusername.Text != string.Empty) { cmd = new SqlCommand("select * from LoginTable where username='******' and password='******'", cn); dr = cmd.ExecuteReader(); if (dr.Read()) { dr.Close(); this.Hide(); MenuFood food = new MenuFood(); food.ShowDialog(); cn.Close(); this.Close(); return; } else { dr.Close(); MessageBox.Show("No Account avilable with this username and password ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Please enter value in all field.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }