jj 25.05.16
This commit is contained in:
@@ -108,6 +108,39 @@
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Overloads Shared Sub SetDataSource(control As DevExpress.XtraGrid.GridControl, dt As DataTable)
|
||||
Dim sw As Stopwatch = Stopwatch.StartNew()
|
||||
Dim columnCount As Integer = dt.Columns.Count
|
||||
|
||||
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.EndUpdate()
|
||||
|
||||
sw.Stop()
|
||||
' Console.WriteLine("SetDataSource for {0} took {1}ms", control.Name, sw.ElapsedMilliseconds)
|
||||
End Sub
|
||||
|
||||
Overloads Shared Sub SetDataSource(control As CustomComboBox, dt As DataTable)
|
||||
Dim sw As Stopwatch = Stopwatch.StartNew()
|
||||
Dim columnCount As Integer = dt.Columns.Count
|
||||
@@ -483,4 +516,21 @@
|
||||
|
||||
End Class
|
||||
|
||||
Public Class DataGridViewCheckable : Inherits _ListControl
|
||||
Public Shared Sub LoadList(control As DevExpress.XtraGrid.GridControl, formId As Integer, ConnId As Object, SQLCommand As String)
|
||||
Dim dynamic As DynamicValue = GetDynamicValue(DirectCast(control.Tag, ClassControlMetadata).Id, formId, ConnId, SQLCommand)
|
||||
|
||||
If dynamic.StaticList IsNot Nothing Then
|
||||
control.DataSource = dynamic.StaticList
|
||||
End If
|
||||
|
||||
If dynamic.DataTable IsNot Nothing AndAlso dynamic.DataTable.Rows.Count > 0 Then
|
||||
SetDataSource(control, dynamic.DataTable)
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
|
||||
Reference in New Issue
Block a user