2021-03-29 11:27:32 +02:00

45 lines
1.5 KiB
VB.net

Imports DigitalData.Controls.LookupGrid
Public Class frmLookup
Private _Datasource As List(Of String) = New List(Of String) From {"Foo", "Bar", "Baz", "Bart", "Maggie", "Homer"}
Private Sub frmLookup_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim oTable = GetDatatable(10)
Dim LookupControl31 As New LookupControl3 With {
.Location = New Point(10, 10),
.Size = New Drawing.Size(100, 27)
}
Dim LookupControl32 As New LookupControl3 With {
.Location = New Point(10, 60),
.Size = New Drawing.Size(100, 27)
}
Controls.AddRange({LookupControl31, LookupControl32})
LookupControl31.Properties.DataSource = oTable
LookupControl32.Properties.MultiSelect = True
LookupControl32.Properties.DataSource = oTable
End Sub
Private Function GetDatatable(Limit As Integer) As DataTable
Dim oDatatable As New DataTable
Dim oColumns As New List(Of DataColumn) From {
New DataColumn("Col1", GetType(String)),
New DataColumn("Col2", GetType(String))
}
oDatatable.Columns.AddRange(oColumns.ToArray)
For Each Item In _Datasource.Take(Limit)
Dim oRow = oDatatable.NewRow()
oRow.Item("Col1") = Item
oRow.Item("Col2") = Item & "_" & "SomeLong Random(String) !!!111einself"
oDatatable.Rows.Add(oRow)
Next
Return oDatatable
End Function
End Class