Dim dtTipe As New DataTable With _SqlCommand .CommandText = "mstTipe_SELECT_id_Nama_WHERE_Merek_Honda" .Parameters.Clear() _SQLReader = .ExecuteReader End With dtTipe.Load(_SQLReader) With lookupTipe .Properties.DataSource = dtTipe .Properties.ValueMember = "Nama" .Properties.DisplayMember = "Nama" .Properties.PopupWidth = 250 End With _SQLReader.Close()
the result of syntax above is:
The problem is, I want to hide the "ID" column because user don't care about it.
Here's the two lines addition code to hide the "ID" column
Dim dtTipe As New DataTable
With _SqlCommand
.CommandText = "mstTipe_SELECT_id_Nama_WHERE_Merek_Honda"
.Parameters.Clear()
_SQLReader = .ExecuteReader
End With
dtTipe.Load(_SQLReader)
With lookupTipe
.Properties.DataSource = dtTipe
.Properties.PopulateColumns()
.Properties.Columns("ID").Visible = False
.Properties.ValueMember = "Nama"
.Properties.DisplayMember = "Nama"
.Properties.PopupWidth = 250
End With
_SQLReader.Close()
You can't hide the column before populate it. So, all you have to do is populate the colum then you can set visibility to false.
0 komentar:
Posting Komentar