DataSet (DataSetSecurity)의 DataTable (DataTableSecurity)에 바인딩 된 VB.net (Visual Studio 2010)의 DataGridView (DataGridViewSecurity)가 있습니다. DataTable의 정수 필드 (nSecLevel)를 기반으로 설정 한 비 바운드 열 (nSecurityComboBox)을 추가했습니다. 콤보 상자를 설정 한 후에는 콤보 상자에 아무 것도 표시하지 않지만 콤보 상자를 선택하면 항목 모음에 5 개의 값이 표시됩니다.Datagridcombobox 값이 표시되지 않습니다.
여기에 내가 콤보 상자 설정하기 위해 다음의 DataTable에 레코드를 추가 사용하고있어 코드입니다 :
Sub Foo()
.
.
.
DataSetSecurity.Tables(0).Rows.Add(New Object() {sName, sID, sSec})
ComboCell_Select(nRow, 3, DataGridViewSecurity, sSecRecs.nSecLevel)
MessageBox.Show("Value for the combo set at " + DataGridViewSecurity.Rows(nRow).Cells(3).Value.ToString)
.
.
.
End Sub
Private Sub ComboCell_Select(ByVal dgvRow As Integer, _
ByVal dgvCol As Integer, _
ByRef DGV As DataGridView,
ByRef nComboBoxRow As Int16)
Try
Dim CBox As DataGridViewComboBoxCell = CType(DGV.Rows(dgvRow).Cells(dgvCol), DataGridViewComboBoxCell)
Dim CCol As DataGridViewComboBoxColumn = CType(DGV.Columns(dgvCol), DataGridViewComboBoxColumn)
CBox.Value = CCol.Items(nComboBoxRow)
DGV.UpdateCellValue(dgvCol, dgvRow)
'MessageBox.Show("New value in the combo box = " + CBox.Value.ToString)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
푸의 messagebox.show이 콤보에 대한 올바른 값을 보여줍니다,하지만 아무것도 표시되지 않습니다 . 누구나 내가 뭘 잘못하고 있는지 알아?
감사합니다.
-NCGrimbo