This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
/
Form1.vb
35 lines (31 loc) · 1.46 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
Imports System
Imports System.Data
Imports System.Windows.Forms
Namespace WindowsApplication1
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 Me.Load
invoicesBindingSource.DataSource = GetInvoicesDataTable()
colUnitPrice.FieldNameSortGroup = "ExtendedPrice"
colUnitPrice.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending
End Sub
Private Function GetInvoicesDataTable() As DataTable
Dim table As DataTable = New DataTable()
table.TableName = "Invoices"
table.Columns.Add(New DataColumn("ProductName", GetType(String)))
table.Columns.Add(New DataColumn("Discount", GetType(Integer)))
table.Columns.Add(New DataColumn("Quantity", GetType(Integer)))
table.Columns.Add(New DataColumn("UnitPrice", GetType(Double)))
table.Columns.Add(New DataColumn("ExtendedPrice", GetType(Double)))
Dim random As Random = New Random()
For i As Integer = 0 To 20 - 1
Dim index As Integer = i + 1
table.Rows.Add("Product " & index, index * 2, index Mod 9, (index + random.[Next](1, 10)) * 1000.0R, (index + random.[Next](1, 10)) * 1000.0R + index * 100.0R)
Next
Return table
End Function
End Class
End Namespace