如果您已使用主詳細請查看help article describing in detail
在你GridControl你必須處理Grid_MasterRowExpanded
,然後把手添加programmaticuly到gridView.SelectionChanged
,該代碼將幫助您
Private Sub Grid_MasterRowExpanded(ByVal sender As System.Object, ByVal e As DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs) Handles Grid.MasterRowExpanded
Dim view As GridView = sender
Dim detail As GridView = view.GetDetailView(e.RowHandle, e.RelationIndex)
detail.OptionsSelection.MultiSelect = True
If e.RowHandle = 0 Or e.RowHandle = 1 Then
AddHandler detail.SelectionChanged, AddressOf detail_SelectionChanged
End If
End Sub
Private Sub detail_SelectionChanged(ByVal sender As System.Object, ByVal e As DevExpress.Data.SelectionChangedEventArgs)
viewSelected = sender
Dim ro As DataRowView = viewSelected.GetFocusedRow
txtEmpId.Text = ro.Item("colEmp_Id")
End Sub
同樣的問題,文本框仍然是空的。我正在使用主細節。 – Jassimi
好的使用Dim ro As DataRowView = viewSelected.GetFocusedRow; txtEmpId.Text = ro.Item(「colEmp_Id」) –
仍然一樣,沒有解決。 – Jassimi