vb.net datagridview如何合并表头
如题
例如,把datagridview表头行第二至第四格合并成一格,急~~
在线等待~
[解决办法]
从这里下载
http://codechina.net/source/2021817
解压后是一个DGVRowmerge.dll,添加到选项卡中:
然后拖放到Form上,这样写代码就可以了:
Dim sqlConn As SqlConnection Dim sqlCmd As SqlCommand Dim sqlDa As SqlDataAdapter Dim sqlDs As DataSet sqlConn = New SqlConnection("Data Source=.;Initial Catalog=jwinfo;Integrated Security=True;") sqlDa = New SqlDataAdapter("SELECT * FROM 学生信息", sqlConn) sqlDs = New DataSet() sqlDa.Fill(sqlDs, "学生信息") RowMergeView1.DataSource = sqlDs.Tables("学生信息") RowMergeView1.AddSpanHeader(2, 2, "合并后的名称") RowMergeView1.ColumnHeadersHeight = 40 RowMergeView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing