22-11-15, 06:31 PM
رجعنالكم مع بعض الاخطاء ياريت تصحيح منكم
وين الخطأ ؟؟
وين الخطأ ؟؟
كود :
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox1.Text = "" Then
MsgBox("يــرجــى إدخــال رقــم الــرخــصــة", MsgBoxStyle.Critical, "خـــطـــأ")
TextBox1.Focus()
Exit Sub
End If
If dt.Rows.Count <> 0 Then
MsgBox("No records found")
DateTimePicker2.Value = Now
TextBox1.Text = ""
TextBox2.Text = ""
TextBox5.Text = ""
ComboBox6.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
TextBox3.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""
ComboBox5.Text = ""
TextBox4.Text = ""
TextBox7.Text = ""
ComboBox3.Visible = False
Else
Dim sqlStr As String = "SELECT * FROM MonitoringReports WHERE EmployeeID = '" & TextBox9.Text & "' and LicensesNumber='" & TextBox1.Text & "'"
Dim dataAdapter As New SqlDataAdapter(sqlStr, con)
dataAdapter.Fill(dt)
For i As Integer = 0 To (dt.Rows.Count - 1)
rowIndex = i
TextBox8.Text = CStr(dt.Rows(rowIndex)("EmployeeName"))
TextBox9.Text = CStr(dt.Rows(rowIndex)("EmployeeID"))
DateTimePicker2.Value = CStr(dt.Rows(rowIndex)("DateOfEntry"))
TextBox1.Text = CStr(dt.Rows(rowIndex)("LicensesNumber"))
TextBox2.Text = CStr(dt.Rows(rowIndex)("LicensesName"))
TextBox5.Text = CStr(dt.Rows(rowIndex)("LicensesType"))
ComboBox6.Text = CStr(dt.Rows(rowIndex)("LicensesCase"))
ComboBox1.Text = CStr(dt.Rows(rowIndex)("Location"))
ComboBox2.Text = CStr(dt.Rows(rowIndex)("Street"))
TextBox3.Text = CStr(dt.Rows(rowIndex)("NearOrNextTo"))
ComboBox3.SelectedValue = CStr(dt.Rows(rowIndex)("ActionType"))
ComboBox7.SelectedValue = CStr(dt.Rows(rowIndex)("ActionNumber"))
ComboBox5.SelectedValue = CStr(dt.Rows(rowIndex)("FineOrWarrningType"))
TextBox4.Text = CStr(dt.Rows(rowIndex)("Notes"))
DateTimePicker1.Value = CStr(dt.Rows(rowIndex)("DateOfFollow"))
Next
End If
End Sub