private void Btn_save_Click(object sender, EventArgs e) { try { if (txt_phone.Text.Length < 11 && txt_phone.Text != "") { MessageBox.Show(" يرجي التاكد من رقم الهاتف لابد ان يكون (11) رقم"); txt_phone.Focus(); } else if (txt_name.Text == "") { MessageBox.Show("يرجي التاكد من اسم الطيار"); } else { d.AddDeleiveryInformation(txt_name.Text, txt_address.Text, txt_phone.Text); MessageBox.Show("تم اضافه الطيار بنجاح", "عمليه الاضافه", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); clears(); dataGridView1.DataSource = d.SelectDeliveryInformation(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void simpleButton1_Click(object sender, EventArgs e) { try { if (txt_name.Text == "") { MessageBox.Show("يرجي التاكد من اسم الطيار"); return; } d.AddDeleiveryInformation(txt_name.Text, txt_address.Text, txt_phone.Text); MessageBox.Show("تم اضافه الطيار بنجاح", "عمليه الاضافه", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); clears(); gridControl1.DataSource = d.SelectDeliveryInformation(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }