22-04-17, 05:15 PM
حذفت جميع البيانات وادخلت بيانات جديدة لكن ظلت المشكلة كما هى
لكن هذا كود زر التعديل الذى تظهر هذه الرسالة عند الضغط عليه اظن ان المشكلة فى هذا الكود
Private Sub butedit_Click(sender As System.Object, e As System.EventArgs) Handles butedit.Click
Try
If dgvdata.RowCount = 0 Then
MsgBox("لا توجد سجلات للتعديل")
Else
frmAEDempdetails.Text = "تعديل بيانات موظف"
frmAEDempdetails.butsave.Visible = False
frmAEDempdetails.butsaveupdate.Visible = True
frmAEDempdetails.txtemp_no.Enabled = True
frmAEDempdetails.txtemp_no.Text = dgvdata.CurrentRow.Cells(0).Value
frmAEDempdetails.txtemp_name.Text = dgvdata.CurrentRow.Cells(1).Value
frmAEDempdetails.combogender.Text = dgvdata.CurrentRow.Cells(2).Value
frmAEDempdetails.comboreligion.Text = dgvdata.CurrentRow.Cells(3).Value
frmAEDempdetails.combosocialstatus.Text = dgvdata.CurrentRow.Cells(4).Value
frmAEDempdetails.txtdob.Text = dgvdata.CurrentRow.Cells(5).Value
frmAEDempdetails.txtage.Text = dgvdata.CurrentRow.Cells(6).Value
frmAEDempdetails.txtnational_no.Text = dgvdata.CurrentRow.Cells(7).Value
frmAEDempdetails.txtinsurance_no.Text = dgvdata.CurrentRow.Cells(8).Value
frmAEDempdetails.combograde.Text = dgvdata.CurrentRow.Cells(9).Value
frmAEDempdetails.txtgrade_year.Text = dgvdata.CurrentRow.Cells(10).Value
frmAEDempdetails.txtphone.Text = dgvdata.CurrentRow.Cells(11).Value
frmAEDempdetails.txtmobile.Text = dgvdata.CurrentRow.Cells(12).Value
frmAEDempdetails.txtadress.Text = dgvdata.CurrentRow.Cells(13).Value
frmAEDempdetails.txtappointment_date.Text = dgvdata.CurrentRow.Cells(14).Value
frmAEDempdetails.txtstartdate.Text = dgvdata.CurrentRow.Cells(15).Value
frmAEDempdetails.txtcurrent_startdate.Text = dgvdata.CurrentRow.Cells(16).Value
frmAEDempdetails.combodegree.Text = dgvdata.CurrentRow.Cells(17).Value
frmAEDempdetails.txtdegree_date.Text = dgvdata.CurrentRow.Cells(18).Value
frmAEDempdetails.txtpension_date.Text = dgvdata.CurrentRow.Cells(19).Value
frmAEDempdetails.txtmonth.Text = dgvdata.CurrentRow.Cells(20).Value
frmAEDempdetails.txtyear.Text = dgvdata.CurrentRow.Cells(21).Value
frmAEDempdetails.combogrouping.Text = dgvdata.CurrentRow.Cells(22).Value
frmAEDempdetails.combojob.Text = dgvdata.CurrentRow.Cells(23).Value
frmAEDempdetails.combosection.Text = dgvdata.CurrentRow.Cells(24).Value
'frmAEDempdetails.txtstatus.Text = dgvdata.CurrentRow.Cells(25).Value
frmAEDempdetails.ShowDialog()
If dgvdata.CurrentRow.Cells(25).Value = True Then
frmAEDempdetails.txtstatus.Text = "بالخدمة"
Else
frmAEDempdetails.txtstatus.Text = "خارج الخدمة"
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
لكن هذا كود زر التعديل الذى تظهر هذه الرسالة عند الضغط عليه اظن ان المشكلة فى هذا الكود
Private Sub butedit_Click(sender As System.Object, e As System.EventArgs) Handles butedit.Click
Try
If dgvdata.RowCount = 0 Then
MsgBox("لا توجد سجلات للتعديل")
Else
frmAEDempdetails.Text = "تعديل بيانات موظف"
frmAEDempdetails.butsave.Visible = False
frmAEDempdetails.butsaveupdate.Visible = True
frmAEDempdetails.txtemp_no.Enabled = True
frmAEDempdetails.txtemp_no.Text = dgvdata.CurrentRow.Cells(0).Value
frmAEDempdetails.txtemp_name.Text = dgvdata.CurrentRow.Cells(1).Value
frmAEDempdetails.combogender.Text = dgvdata.CurrentRow.Cells(2).Value
frmAEDempdetails.comboreligion.Text = dgvdata.CurrentRow.Cells(3).Value
frmAEDempdetails.combosocialstatus.Text = dgvdata.CurrentRow.Cells(4).Value
frmAEDempdetails.txtdob.Text = dgvdata.CurrentRow.Cells(5).Value
frmAEDempdetails.txtage.Text = dgvdata.CurrentRow.Cells(6).Value
frmAEDempdetails.txtnational_no.Text = dgvdata.CurrentRow.Cells(7).Value
frmAEDempdetails.txtinsurance_no.Text = dgvdata.CurrentRow.Cells(8).Value
frmAEDempdetails.combograde.Text = dgvdata.CurrentRow.Cells(9).Value
frmAEDempdetails.txtgrade_year.Text = dgvdata.CurrentRow.Cells(10).Value
frmAEDempdetails.txtphone.Text = dgvdata.CurrentRow.Cells(11).Value
frmAEDempdetails.txtmobile.Text = dgvdata.CurrentRow.Cells(12).Value
frmAEDempdetails.txtadress.Text = dgvdata.CurrentRow.Cells(13).Value
frmAEDempdetails.txtappointment_date.Text = dgvdata.CurrentRow.Cells(14).Value
frmAEDempdetails.txtstartdate.Text = dgvdata.CurrentRow.Cells(15).Value
frmAEDempdetails.txtcurrent_startdate.Text = dgvdata.CurrentRow.Cells(16).Value
frmAEDempdetails.combodegree.Text = dgvdata.CurrentRow.Cells(17).Value
frmAEDempdetails.txtdegree_date.Text = dgvdata.CurrentRow.Cells(18).Value
frmAEDempdetails.txtpension_date.Text = dgvdata.CurrentRow.Cells(19).Value
frmAEDempdetails.txtmonth.Text = dgvdata.CurrentRow.Cells(20).Value
frmAEDempdetails.txtyear.Text = dgvdata.CurrentRow.Cells(21).Value
frmAEDempdetails.combogrouping.Text = dgvdata.CurrentRow.Cells(22).Value
frmAEDempdetails.combojob.Text = dgvdata.CurrentRow.Cells(23).Value
frmAEDempdetails.combosection.Text = dgvdata.CurrentRow.Cells(24).Value
'frmAEDempdetails.txtstatus.Text = dgvdata.CurrentRow.Cells(25).Value
frmAEDempdetails.ShowDialog()
If dgvdata.CurrentRow.Cells(25).Value = True Then
frmAEDempdetails.txtstatus.Text = "بالخدمة"
Else
frmAEDempdetails.txtstatus.Text = "خارج الخدمة"
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub