Why doesn't my DataGridView have an index row or first row on the first load form in vb.net.
is there something wrong with my code?
Thanks
Public Class Form1
Private itemtransfer As New List(Of ItemTransfer)()
Private Sub AddColumnsProgrammatically()
Dim col1 = New DataGridViewTextBoxColumn()
Dim col2 = New DataGridViewTextBoxColumn()
col1.HeaderText = "No"
col1.Name = "No"
col1.DataPropertyName = "No"
col2.HeaderText = "CodeProduct"
col2.Name = "CodeProduct"
col2.DataPropertyName = "CodeProduct"
DataGridView1.Columns.AddRange(New DataGridViewColumn() {col1, col2})
End Sub
Private Sub LoadData()
DataGridView1.DataSource = itemtransfer
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
AddColumnsProgrammatically()
LoadData()
End Sub
Public Class ItemTransfer
Public Property No() As Integer
Public Property CodeProduct() As String
End Class