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