/
Form1.vb
90 lines (72 loc) · 2.43 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
Imports System
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Imports DevExpress.XtraVerticalGrid.Rows
Namespace AddRowsRuntime
Public Partial Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
propertyGridControl1.AutoGenerateRows = False
CreateRows()
Dim person As Person = New Person()
person.LastName = "Doe"
person.FirstName = "John"
propertyGridControl1.SelectedObject = person
End Sub
Private Sub CreateRows()
Dim rowLastName As EditorRow = New EditorRow("LastName")
rowLastName.Properties.Caption = "Last name"
propertyGridControl1.Rows.Add(rowLastName)
Dim rowCategory As CategoryRow = New CategoryRow("Address")
propertyGridControl1.Rows.Add(rowCategory)
Dim rowAddressLine1 As EditorRow = New EditorRow("AddressLine1")
rowAddressLine1.Properties.Caption = "Address Line 1"
rowCategory.ChildRows.Add(rowAddressLine1)
Dim rowZip As EditorRow = New EditorRow("Zip")
rowZip.Properties.Caption = "Zip Code"
rowCategory.ChildRows.Add(rowZip)
End Sub
End Class
Public Class Person
Private _FirstName As String
Public Property FirstName As String
Get
Return _FirstName
End Get
Set(ByVal value As String)
_FirstName = value
End Set
End Property
Private _LastName As String
Public Property LastName As String
Get
Return _LastName
End Get
Set(ByVal value As String)
_LastName = value
End Set
End Property
Private _AddressLine1 As String
Public Property AddressLine1 As String
Get
Return _AddressLine1
End Get
Set(ByVal value As String)
_AddressLine1 = value
End Set
End Property
Private _Zip As String
Public Property Zip As String
Get
Return _Zip
End Get
Set(ByVal value As String)
_Zip = value
End Set
End Property
End Class
End Namespace