I'm using C# winforms I have a form with combobox called cmbExport
and two textboxes txtDateSend
and txtSendNum
The combobox get its data from a stored procedure GET_ALL_EXPORT_WITHNULL
cmbExport.DataSource = cmp.GET_ALL_EXPORT_WITHNULL();
cmbExport.DisplayMember = "side";
cmbExport.ValueMember = "ID_EXPORT";
cmbExport.SelectedValue = "6";
When the user NOT choose certain values from the combobox and one of the textboxes are empty a meesage box appear
I tried this code but it didn't work:
int x = Convert.ToInt32(cmbExport.SelectedValue); //Its already integer but the code didn't accept int x = cmbExport.SelectedValue; ???
string ds = txtDateSend.Text;
string sn = txtSendNum.Text;
if ((x != 6 || x != 42 || x != 1042) && string.IsNullOrEmpty(sn))
{
MessageBox.Show("you should enter a send number");
return;
}
else if ((x != 6 || x != 42 || x != 1042) && string.IsNullOrEmpty(ds))
{
MessageBox.Show("you should enter a date send);
return;
}
thank you
Aucun commentaire:
Enregistrer un commentaire