This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Form1.vb
77 lines (63 loc) · 1.86 KB
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Namespace LookUpEditDemo
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private table As DataTable
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
table = CreateTable()
FillComboBox()
SetupLookup()
End Sub
Private Function CreateTable() As DataTable
Dim table As New DataTable()
Dim dataRow As DataRow
table.Columns.Add("ID", GetType(Integer))
table.Columns.Add("Name", GetType(String))
dataRow = table.NewRow()
dataRow("ID") = 840
dataRow("Name") = "US"
table.Rows.Add(dataRow)
dataRow = table.NewRow()
dataRow("ID") = 124
dataRow("Name") = "Canada"
table.Rows.Add(dataRow)
dataRow = table.NewRow()
dataRow("ID") = 36
dataRow("Name") = "Australia"
table.Rows.Add(dataRow)
dataRow = table.NewRow()
dataRow("ID") = 826
dataRow("Name") = "UK"
table.Rows.Add(dataRow)
dataRow = table.NewRow()
dataRow("ID") = 554
dataRow("Name") = "New Zealand"
table.Rows.Add(dataRow)
Return table
End Function
Public Sub FillComboBox()
For Each Row As DataRow In table.Rows
comboBoxEdit1.Properties.Items.Add(Row("Name"))
Next Row
comboBoxEdit1.Properties.Sorted = True
End Sub
Public Sub SetupLookup()
lookUpEdit1.Properties.DataSource = table
lookUpEdit1.Properties.DisplayMember = "Name"
lookUpEdit1.Properties.ValueMember = "ID"
Dim col As DevExpress.XtraEditors.Controls.LookUpColumnInfo
col = New DevExpress.XtraEditors.Controls.LookUpColumnInfo("Name", "Country", 100)
col.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending
lookUpEdit1.Properties.Columns.Add(col)
End Sub
End Class
End Namespace