|
■No96083 (freeway さん) に返信
こんな感じでどうでしょう?
Public Class UserControl1
Public Sub New()
' この呼び出しはデザイナーで必要です。
InitializeComponent()
' InitializeComponent() 呼び出しの後で初期化を追加します。
AddHandler DataGridView1.Paint, AddressOf FirstPaint
End Sub
Private Sub FirstPaint(sender As Object, e As PaintEventArgs)
RemoveHandler DataGridView1.Paint, AddressOf FirstPaint
Dim tbl As New DataTable()
With tbl.Columns
.Add("column1")
.Add("column2")
.Add("column3")
End With
tbl.Rows.Add({"a1", "b1", "c1"})
tbl.Rows.Add({"a2", "b2", "c2"})
tbl.Rows.Add({"a3", "b3", "c3"})
tbl.AcceptChanges()
DataGridView1.DataSource = tbl
End Sub
End Class
|