如何限制Datagridview
列中的行数,让50个记录并将其他50个放入同一个Datagridview
的下一列?在我的vb.net项目中,我不能上下滚动。
Datagridview从excel表中提取数据。
感谢您的帮助
答案 0 :(得分:0)
试试这个。
dataGridView1.RowCount = 50; //Let say we have 50 rows
if (dataGridView1.Rows.Count >= 50)
{
//TODO:
}
答案 1 :(得分:0)
我认为这是单列表..
dim tbl as DataTable '--------> this is your displayed table
dim nLimit as Integer = 15 '----- this is your limit as you want
dim dc as DataColumn
'get column name
dim sCol as String = tbl.Columns(0).Name
dim nRow as Integer = tbl.rows.count
'how much column ?
dim n as Integer = nRow / nLimit
if n * nLimit < nRow then n+= 1
for x as Integer = 1 to n
dc = New DataColumn
dc.DataType = System.Type.GetType("System.String")
dc.Caption = sCol & n.ToString
dc.ColumnName = sCol & n.ToString
tbl.Columns.Add(dc)
next
然后你可以展示它......