jj 31.05
This commit is contained in:
@@ -114,27 +114,12 @@
|
||||
|
||||
control.BeginUpdate()
|
||||
|
||||
Dim DT_Check As New DataTable
|
||||
Dim col_chk As New DataColumn(" ", GetType(Boolean))
|
||||
Dim col_str As New DataColumn("String_Value", GetType(String))
|
||||
col_str.Caption = dt.Columns(0).Caption
|
||||
col_str.ReadOnly = True
|
||||
|
||||
DT_Check.Columns.Add(col_chk)
|
||||
DT_Check.Columns.Add(col_str)
|
||||
|
||||
' Daten füllen
|
||||
For Each row As DataRow In dt.Rows
|
||||
DT_Check.Rows.Add(False, row.Item(0))
|
||||
Next
|
||||
|
||||
' Damit beim Setzen von DisplayMember und ValueMember kein Fehler auftritt,
|
||||
' muss die Datasource zunächst geleert werden und der selected index auf -1 gesetzt werden.
|
||||
control.DataSource = Nothing
|
||||
|
||||
' Als letztes setzen wir die DataSource
|
||||
control.DataSource = DT_Check
|
||||
DirectCast(control.MainView, DevExpress.XtraGrid.Views.Grid.GridView).Columns(0).Width = 10
|
||||
control.DataSource = dt
|
||||
control.EndUpdate()
|
||||
|
||||
sw.Stop()
|
||||
@@ -531,6 +516,19 @@
|
||||
|
||||
End Sub
|
||||
|
||||
Public Shared Sub LoadValue(control As DevExpress.XtraGrid.GridControl, values As List(Of Object))
|
||||
Dim gridview As DevExpress.XtraGrid.Views.Grid.GridView = control.MainView
|
||||
For i As Integer = 0 To gridview.RowCount - 1
|
||||
Dim fieldName As String = gridview.Columns(0).FieldName
|
||||
Dim rowhandle As Integer = gridview.GetRowHandle(i)
|
||||
Dim rowvalue As String = gridview.GetRowCellValue(rowhandle, fieldName)
|
||||
|
||||
If values.Contains(rowvalue) Then
|
||||
gridview.SelectRow(rowhandle)
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
|
||||
Reference in New Issue
Block a user