lots of bugfixing for lookupgrid
This commit is contained in:
37
LookupControlGui/Form1.vb
Normal file
37
LookupControlGui/Form1.vb
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
|
||||
|
||||
Public Class Form1
|
||||
Private _Datasource As New List(Of String) From {"Foo", "bar", "baz", "quux"}
|
||||
|
||||
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
|
||||
Dim oDatatable = GetDatatable()
|
||||
Dim oSelectedValues = _Datasource.Take(1).ToList()
|
||||
|
||||
LookupControl.DataSource = oDatatable
|
||||
LookupControl.SelectedValues = oSelectedValues
|
||||
End Sub
|
||||
|
||||
Private Function GetDatatable() As DataTable
|
||||
Dim oDatatable As New DataTable
|
||||
Dim oColumns As New List(Of DataColumn) From {
|
||||
New DataColumn("Col1", GetType(String))
|
||||
}
|
||||
|
||||
oDatatable.Columns.AddRange(oColumns.ToArray)
|
||||
|
||||
For Each Item In _Datasource
|
||||
Dim oRow = oDatatable.NewRow()
|
||||
oRow.Item("Col1") = Item
|
||||
oDatatable.Rows.Add(oRow)
|
||||
Next
|
||||
|
||||
|
||||
Return oDatatable
|
||||
End Function
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
MsgBox(LookupControl.SelectedValues.Count)
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user