vb.net怎么使用表格控件?
我想在vb.net窗体中加入一个表格控件,用来显示比如4行3列的数据,第一列列间距100,第二列500,第三列300。行间距全部为200。...
我想在vb.net窗体中加入一个表格控件,用来显示比如4行3列的数据,第一列列间距100,第二列500,第三列300。行间距全部为200。
展开
1个回答
展开全部
DataGridView控件,放一个DataGridView1和Button1到窗体,下面是按钮下代码
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.DataGridView1.AllowUserToAddRows = False
DataGridView1.RowTemplate.Height = 200
DataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None
For i = 1 To 3
Me.DataGridView1.Columns.Add("列" & i.ToString, "列" & i.ToString)
Me.DataGridView1.Rows.Add()
Next
Me.DataGridView1.Columns(0).Width = 100
Me.DataGridView1.Columns(1).Width = 500
Me.DataGridView1.Columns(0).Width = 300
End Sub
'自己设置相关需要的属性即可
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.DataGridView1.AllowUserToAddRows = False
DataGridView1.RowTemplate.Height = 200
DataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None
For i = 1 To 3
Me.DataGridView1.Columns.Add("列" & i.ToString, "列" & i.ToString)
Me.DataGridView1.Rows.Add()
Next
Me.DataGridView1.Columns(0).Width = 100
Me.DataGridView1.Columns(1).Width = 500
Me.DataGridView1.Columns(0).Width = 300
End Sub
'自己设置相关需要的属性即可
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询