您好我想在page_load
个事件
我如何实现这一目标?
我已尝试过以下代码
dgv_beli.AutoGenerateColumns = False
dgv_beli.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None
dgv_beli.SelectionMode = DataGridViewSelectionMode.FullRowSelect
'DEFINE COLUMN MANUALLY
'kode barang
Dim colKode As New DataGridViewTextBoxColumn
colKode.HeaderText = "Kode"
colKode.Name = "Kode"
'nama barang
Dim colNama As New DataGridViewTextBoxColumn
colNama.HeaderText = "Nama"
colNama.Name = "Nama"
'jenis
Dim colJenis As New DataGridViewTextBoxColumn
colJenis.HeaderText = "Jenis"
colJenis.Name = "kd_jenis"
colJenis.Width = 120
dgv_beli.AllowUserToAddRows = True
dgv_beli.Columns.Add(colKode)
colKode.ReadOnly = True
dgv_beli.Columns.Add(colNama)
colNama.ReadOnly = True
dgv_beli.Columns.Add(colJenis)
colJenis.ReadOnly = True
dgv_beli.Sort(dgv_beli.Columns(0), System.ComponentModel.ListSortDirection.Ascending)
dgv_beli.Rows.Add(colKode, colNama, colJenis)
但是datagridview
stll为空
请帮助我解决这个问题..谢谢