Описание ошибки преобразование из строки "firstnametextbox.text" типа' ' В тип integer недопустимо для поиска по сетке
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click On Error GoTo SearchErr If txtsearch.Text = " " Then Call notfound() Exit Sub Else Dim cantfind As String = txtsearch.Text Me.dgvfill() DoctorBindingSource.Filter = ("Doctor_s_NHS_NoTextBox.Text like '" & txtsearch.Text & "'")("FirstnameTextBox.Text like '" & txtsearch.Text & "'") & _ ("SurnameTextBox.Text like '" & txtsearch.Text & "'")("Medical_Center_NameTextBox.Text like '" & txtsearch.Text & "'") & _ ("Email_AddressTextBox.Text like '" & txtsearch.Text & "'")("Patient_NHS_NumberTextBox.Text like '" & txtsearch.Text & "'") & _ ("GP_Appointment_RefTextBox.Text like '" & txtsearch.Text & "'")("Patient_IDTextBox.Text like '" & txtsearch.Text & "'") If DoctorBindingSource.Count <> 0 Then With DoctorDataGridView .DataSource = DoctorBindingSource End With Else Me.notfound() MsgBox("--> " & cantfind & vbNewLine & _ "The search item was not found", _ MsgBoxStyle.Information, "Hey Boss") DoctorBindingSource.Filter = Nothing With DoctorDataGridView .ClearSelection() .ReadOnly = True .MultiSelect = False .DataSource = DoctorBindingSource End With End If End If ErrExit: Exit Sub SearchErr: MsgBox("error number" & Err.Number & vbNewLine & _ "error description " & Err.Description, MsgBoxStyle.Critical, _ "reset error!") Resume ErrExit End Sub Private Sub reset() Dim txtS As TextBox = txtsearch With txtS .Text = "" .Select() .BackColor = Color.LightCyan End With cboOfColor.SelectedItem = "MistyRose" cboAltColor.SelectedItem = "Gold" cboOfColor.BackColor = Color.LightCyan cboAltColor.BackColor = Color.LightCyan If DoctorDataGridView.DataSource Is Nothing Then Exit Sub End If Dim dgv As DataGridView = DoctorDataGridView With dgv .RowsDefaultCellStyle.BackColor = Color.FromName(cboOfColor.SelectedItem) .AlternatingRowsDefaultCellStyle.BackColor = Color.FromName(cboAltColor.SelectedItem) End With End Sub Private Sub dgvfill() txtsearch.BackColor = Color.LightBlue If DoctorDataGridView.DataSource Is Nothing Then Exit Sub End If Dim dgv1 As DataGridView = DoctorDataGridView With dgv1 .RowsDefaultCellStyle.BackColor = Color.FromName(cboOfColor.SelectedItem) .AlternatingRowsDefaultCellStyle.BackColor = Color.FromName(cboAltColor.SelectedItem) End With End Sub Private Sub notfound() Dim txtS As TextBox = txtsearch With txtS .BackColor = Color.White .Select() .SelectAll() End With If DoctorDataGridView.DataSource Is Nothing Then Exit Sub End If Dim dgv2 As DataGridView = DoctorDataGridView With dgv2 .RowsDefaultCellStyle.BackColor = Color.White .AlternatingRowsDefaultCellStyle.BackColor = Color.White End With End Sub End Class
Что я уже пробовал:
я пытаюсь инициализировать эти поля как целое число, но все равно возникает ошибка ...потому что я думаю, что в начале текстового поля есть"", которое делает его строкой...пожалуйста, помогите мне