Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Creating the columns
Dim IDColumn As New DataGridViewColumn
Dim ClientNameColumn As New DataGridViewColumn
Dim AmountColumn As New DataGridViewColumn
'Setting the Properties for the IDColumn
IDColumn.Name = "ID"
IDColumn.ValueType = GetType(Integer)
IDColumn.HeaderText = "ID"
IDColumn.CellTemplate = New DataGridViewTextBoxCell
'Setting the Properties for the ClientNameColumn
ClientNameColumn.Name = "ClientName"
ClientNameColumn.ValueType = GetType(String)
ClientNameColumn.HeaderText = "Name"
ClientNameColumn.CellTemplate = New DataGridViewTextBoxCell
'Setting the Properties for the AmountColumn
AmountColumn.Name = "Amount"
AmountColumn.ValueType = GetType(Decimal)
AmountColumn.HeaderText = "Amount"
AmountColumn.CellTemplate = New DataGridViewTextBoxCell
With dtgRecords
'Adding the Column to the DataGridView
.Columns.Add(IDColumn)
.Columns.Add(ClientNameColumn)
.Columns.Add(AmountColumn)
'Making the DataGridView ReadOnly since we don't want the user to edit the grid at the moment
.ReadOnly = True
'allowing only one row to be selected at a time
.MultiSelect = False
'restricting user capabilities on the DataGridView
.AllowUserToAddRows = False
.AllowUserToDeleteRows = False
End With
End Sub