0
我需要将form2中的datagridview值绑定到form1中的单选按钮上。我刚刚得到这个错误从字符串“男”转换为类型“布尔”无效。我怎样才能解决这个将datagridview的值绑定到单选按钮
这里是我的代码:
Private Sub dgCostumerSearch_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgCostumerSearch.CellDoubleClick
Try
costumer.txtcostID.Text = dgCostumerSearch.Rows(dgCostumerSearch.CurrentRow.Index) _
.Cells(0).Value
costumer.txtcostName.Text = dgCostumerSearch.Rows(dgCostumerSearch.CurrentRow.Index) _
.Cells(1).Value
costumer.txtcostLastName.Text = dgCostumerSearch.Rows(dgCostumerSearch.CurrentRow.Index) _
.Cells(2).Value
If dgCostumerSearch.CurrentRow.Cells(3).Value.Equals("Male") Then
costumer.rbMaleCost.Checked = dgCostumerSearch.Rows(dgCostumerSearch.CurrentRow.Index) _
.Cells(3).Value
End If
If dgCostumerSearch.CurrentRow.Cells(3).Value.Equals("Female") Then
costumer.rbFemCost.Checked = dgCostumerSearch.Rows(dgCostumerSearch.CurrentRow.Index) _
.Cells(3).Value
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
提前感谢!
谢谢法比奥!我已经试过你的代码,它的工作。 – TecZr