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 0
/
Form1.vb
111 lines (102 loc) · 3.66 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Imports DevExpress.Utils.Drawing
Imports DevExpress.XtraEditors.Filtering
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Columns
Imports DevExpress.XtraGrid.FilterEditor
Imports DevExpress.XtraGrid.Registrator
Imports DevExpress.XtraGrid.Scrolling
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraGrid.Views.Grid.Handler
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Forms
Namespace WindowsFormsApplication6
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
Dim customers = GetCustomers()
Dim source1 As New BindingList(Of Customer)(customers)
Me.gridControl1.DataSource = source1
gridView1.SetColumns(New List(Of GridColumn)() From {gridView1.Columns(2), gridView1.Columns(3)})
For Each col As GridColumn In gridView1.Columns
col.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains
Next col
gridView1.OptionsView.ShowAutoFilterRow = True
End Sub
Public Function GetCustomers() As IList(Of Customer)
Dim customers As IList(Of Customer) = New List(Of Customer)()
customers.Add(New Customer() With {.FirstName = "Charlotte", .LastName = "Cooper", .IsEnabled = True})
customers.Add(New Customer() With {.FirstName = "Shelley", .LastName = "Burke", .IsEnabled = True})
customers.Add(New Customer() With {.FirstName = "Regina", .LastName = "Murphy", .IsEnabled = True})
customers.Add(New Customer() With {.FirstName = "Yoshi", .LastName = "Nagase", .IsEnabled = True})
customers.Add(New Customer() With {.FirstName = "Mayumi", .LastName = "Ohno", .IsEnabled = True})
customers.Add(New Customer() With {.FirstName = "Nancy", .LastName = "Davolio", .IsEnabled = True})
customers.Add(New Customer() With {.FirstName = "Andrew", .LastName = "Fuller", .IsEnabled = True})
customers.Add(New Customer() With {.FirstName = "Janet", .LastName = "Leverling", .IsEnabled = True})
customers.Add(New Customer() With {.FirstName = "Steven", .LastName = "Buchanan", .IsEnabled = True})
customers.Add(New Customer() With {.FirstName = "Michael", .LastName = "Suyama", .IsEnabled = True})
customers.Add(New Customer() With {.FirstName = "Robert", .LastName = "King", .IsEnabled = True})
customers.Add(New Customer() With {.FirstName = "Laura", .LastName = "Callahan", .IsEnabled = True})
customers.Add(New Customer() With {.FirstName = "Anne", .LastName = "Dodsworth", .IsEnabled = True})
Return customers
End Function
End Class
Public Class Customer
Private _id As Integer
Private _firstName As String
Private _lastName As String
Private _isEnabled As Boolean
Public Sub New()
End Sub
Public Property Id() As Integer
Get
Return _id
End Get
Set(ByVal value As Integer)
If value <> _id Then
_id = value
End If
End Set
End Property
Public Property IsEnabled() As Boolean
Get
Return _isEnabled
End Get
Set(ByVal value As Boolean)
If value <> _isEnabled Then
_isEnabled = value
End If
End Set
End Property
Public Property FirstName() As String
Get
Return _firstName
End Get
Set(ByVal value As String)
If value <> _firstName Then
_firstName = value
End If
End Set
End Property
Public Property LastName() As String
Get
Return _lastName
End Get
Set(ByVal value As String)
If value <> _lastName Then
_lastName = value
End If
End Set
End Property
End Class
End Namespace