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
44 lines (37 loc) · 1.87 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
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 System.Data.Objects
Imports System.Data.Objects.DataClasses
Imports NorthwindModel
Namespace Entities
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
Dim northwind As New NorthwindEntities()
Dim customersQuery As ObjectQuery(Of Customers) = northwind.Customers.Include("Orders")
gridControl1.DataSource = New BindingSource(customersQuery, "")
gridView1.OptionsSelection.MultiSelect = True
End Sub
Private Sub gridView1_MasterRowEmpty(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.MasterRowEmptyEventArgs) Handles gridView1.MasterRowEmpty
Dim c As Customers = CType(gridView1.GetRow(e.RowHandle), Customers)
e.IsEmpty = c.Orders.Count = 0
End Sub
Private Sub gridView1_MasterRowGetRelationCount(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.MasterRowGetRelationCountEventArgs) Handles gridView1.MasterRowGetRelationCount
e.RelationCount = 1
End Sub
Private Sub gridView1_MasterRowGetRelationName(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.MasterRowGetRelationNameEventArgs) Handles gridView1.MasterRowGetRelationName
e.RelationName = "Orders"
End Sub
Private Sub gridView1_MasterRowGetChildList(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.MasterRowGetChildListEventArgs) Handles gridView1.MasterRowGetChildList
Dim c As Customers = CType(gridView1.GetRow(e.RowHandle), Customers)
e.ChildList = New BindingSource(c, "Orders")
End Sub
End Class
End Namespace