abdujalil  chuliev

abdujalil chuliev

  • 1.2k
  • 400
  • 38.8k

wpf validatin

Jan 20 2016 9:11 AM
There are 2 comboboxes and 2 textboxes in my wpf project.
I want to set fill in validation.
It says "Fill in properly" even I fill them properly.
Below is my code:
private void Reg()
{
if (txtDate.Text != null & txtTime.Text != null & cmbGroup1.SelectedIndex > 0 & cmbName1.SelectedIndex > 0)
{
MySqlConnection con = new MySqlConnection(constr);
MySqlCommand cmd = new MySqlCommand("INSERT INTO Regiter(Date,Time,Image_ID,Students_ID) "
+ "VALUES ('" + txtDate.Text + "','" + txtTime.Text + "','" + getMaxRasmID() + "','" + getStudentsID() + "')", con);
con.Open();
int i = cmd.ExecuteNonQuery();
if (i > 0)
{
MessageBox.Show("Registered");
}
con.Close();
}
else
{
MessageBox.Show("Fill in properly");
}

}

Answers (1)