Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'新增一行控制項到 DataGridView(己知可以插入的控制項:button, checkbox, combobox, image, link, textbox)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'新增一行控制項到 DataGridView(己知可以插入的控制項:button, checkbox, combobox, image, link, textbox)
Dim tmpTB As New DataTable
Dim NewColumn As New DataGridViewCheckBoxColumn
Dim NewColumn As New DataGridViewCheckBoxColumn
With tmpTB
.Columns.Add("單別")
.Columns.Add("單號")
For i As Integer = 0 To 10
Dim newRow As DataRow = .NewRow()
newRow("單別") = i
newRow("單號") = i + 11
.Rows.Add(newRow)
Next
.Columns.Add("單別")
.Columns.Add("單號")
For i As Integer = 0 To 10
Dim newRow As DataRow = .NewRow()
newRow("單別") = i
newRow("單號") = i + 11
.Rows.Add(newRow)
Next
End With
With DataGridView1
.DataSource = tmpTB
.Columns.Insert(0, NewColumn)
.Columns(0).Width = 50
.Columns(0).Name = "製令"
.Columns(0).Frozen = True
.ReadOnly = False
End With
End Sub.DataSource = tmpTB
.Columns.Insert(0, NewColumn)
.Columns(0).Width = 50
.Columns(0).Name = "製令"
.Columns(0).Frozen = True
.ReadOnly = False
End With
End Class
沒有留言:
張貼留言