0
두 개의 datagrid gridproperty 및 gridpropertyselection이 있습니다. 데이터가 포함 된 테이블이 하나 있습니다. gridProperty datagrid 선택한 행에 따라 gridpropertyselection 명명 된 datagridviw 데이터를 papulate합니다.다른 datagridview의 선택된 행에 따라 datagridview 채우기
어떤 이벤트가 필요한지 알고 싶습니다. 나는 다음 코드를 trid. 그러나 정수 = gridProperty.CurrentRow.Index이 라인으로 희미한 인덱스에 오류가 발생하는 것은
Private Sub gridProperty_SelectionChanged(ByVal Sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowStateChangedEventArgs) Handles gridProperty.RowStateChanged
Dim dtPropertySelection As DataTable = m_ds.Tables(0)
Dim i As Integer
Dim count As Integer = gridPropertySelection.Rows.Count
' If (gridProperty.CurrentRow.IsNewRow IsNot Nothing) Then
Dim index As Integer = gridProperty.CurrentRow.Index
Dim PropertyID As Integer = gridProperty.Rows(index).Cells("PropertyID").Value
While i < dtPropertySelection.Rows.Count
If PropertyID = dtPropertySelection.Rows(i).Item("PropertyID") Then
gridPropertySelection.Rows.Add()
gridPropertySelection.Rows(count).Cells("colSelectionDescription").Value() = dtPropertySelection.Rows(i).Item("SelectionDescription")
gridPropertySelection.Rows(count).Cells("colAssociatedText").Value() = dtPropertySelection.Rows(i).Item("AssociatedText")
count = count + 1
End If
i = i + 1
End While
()는 라인도 – user2194838
모든 데이터가 정수 = gridProperty.CurrentCell.RowIndex 희미한 인덱스를 사용하여 오류 "개체의 인스턴스로 설정되지 않은 개체 참조"있어 사용하려고 당신의'gridProperty'? 또한 변경된 선택 사항 대신 이벤트를 CellClick으로 변경하십시오. – Codemunkeee
cellclick 이벤트를 선택한 다음 선택한 기본 행을 사용하는 경우 양식로드시 데이터가 다른 DataGrid에 채워지지 않습니다. – user2194838