-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.vb
74 lines (62 loc) · 2.36 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
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports DevExpress.Utils
Imports DevExpress.XtraEditors.Controls
Namespace LookUpEditWithHints
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
lookUpEditHints1.Properties.DataSource = FillTable()
lookUpEditHints1.Properties.DisplayMember = "Customer"
lookUpEditHints1.Properties.DescriptionField = "Description"
AddHandler lookUpEditHints1.BeforeShowingTooltip, AddressOf lookUpEditHints1_BeforeShowingTooltip
' LookUpEdit customization: adding two columns from DataSource
' and making one of them invisible
Dim coll As LookUpColumnInfoCollection = lookUpEditHints1.Properties.Columns
coll.Add(New LookUpColumnInfo("Customer"))
coll.Add(New LookUpColumnInfo("Description"))
lookUpEditHints1.Properties.Columns("Description").Visible = False
End Sub
Private Sub lookUpEditHints1_BeforeShowingTooltip(ByVal sender As Object, ByVal e As EventArgs)
Dim ee As ToolTipControllerShowEventArgs = TryCast(e, ToolTipControllerShowEventArgs)
ee.ToolTip &= " + custom tool tip also can be added"
End Sub
Private Function FillTable() As DataTable
Dim _customersTable As New DataTable()
Dim col As DataColumn
Dim row As DataRow
_customersTable.TableName = "Customers"
col = New DataColumn()
col.ColumnName = "Customer"
col.DataType = System.Type.GetType("System.String")
_customersTable.Columns.Add(col)
col = New DataColumn()
col.ColumnName = "Description"
col.DataType = System.Type.GetType("System.String")
_customersTable.Columns.Add(col)
row = _customersTable.NewRow()
row("Customer") = "John"
row("Description") = "A description for customer John"
_customersTable.Rows.Add(row)
row = _customersTable.NewRow()
row("Customer") = "Jane"
row("Description") = "A description for customer Jane"
_customersTable.Rows.Add(row)
row = _customersTable.NewRow()
row("Customer") = "Jack"
row("Description") = "A description for customer Jack"
_customersTable.Rows.Add(row)
Return _customersTable
End Function
End Class
End Namespace