且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在网格视图的标题列中加载表值

更新时间:2023-10-19 18:35:34

将表绑定到Gridview并设置Auto Generated Column = True
Bind table to Gridview and set Auto Generated Column = True


,您可以像这样遍历数据网格:

对于每个col作为Me.yourDataGridView.Columns中的DataGridViewColumn
col.HeaderText =您的表值"
下一个

您可以通过遍历数据集来获取您的表值".
you can loop thru your data grid like this:

For Each col as DataGridViewColumn in Me.yourDataGridView.Columns
col.HeaderText = "your table values"
Next

you can get "your table values" by looping thru your dataset. if your using dataset to load your data.


谢谢,但是它向我显示了表的列,我是否需要表的值.

表< location>

Location_ID Location_Name
1陈列室1
2陈列室2
3 Godown
4等
5等

我需要在gridview标头中使用showrrom1,showroom2等.

谢谢
Thanks, but it shows me column of the table whether i need values of table.

Table <location>

Location_ID Location_Name
1 Showroom1
2 Showroom2
3 Godown
4 etc
5 etc

i need showrrom1, showroom2 etc at gridview header.

Thanks