DataGridView控制元件,放一個DataGridView1和Button1到窗體,下面是按鈕下程式碼Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.ClickMe.DataGridView1.AllowUserToAddRows = FalseDataGridView1.RowTemplate.Height = 200DataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.NoneFor i = 1 To 3Me.DataGridView1.Columns.Add("列" & i.ToString, "列" & i.ToString)Me.DataGridView1.Rows.Add()NextMe.DataGridView1.Columns(0).Width = 100Me.DataGridView1.Columns(1).Width = 500Me.DataGridView1.Columns(0).Width = 300End Sub"自己設定相關需要的屬性即可
DataGridView控制元件,放一個DataGridView1和Button1到窗體,下面是按鈕下程式碼Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.ClickMe.DataGridView1.AllowUserToAddRows = FalseDataGridView1.RowTemplate.Height = 200DataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.NoneFor i = 1 To 3Me.DataGridView1.Columns.Add("列" & i.ToString, "列" & i.ToString)Me.DataGridView1.Rows.Add()NextMe.DataGridView1.Columns(0).Width = 100Me.DataGridView1.Columns(1).Width = 500Me.DataGridView1.Columns(0).Width = 300End Sub"自己設定相關需要的屬性即可