Initialize custom DataGridView
Posted on 2006-06-26
I have an extended version of a DataGridView control which I want by default to instantiate with 7 columns and 5 rows.
Partial Public Class CustomDataGridView
Public Sub New()
' This call is required by the Windows Form Designer.
' Add any initialization after the InitializeComponent() call
Me.RowCount = 5
Me.ColumnCount = 7
When I drag and drop the control on a blank form I indeed get a 7x5 grid but if I hit run I get 14 columns with 5 rows and the 7 new columns. Obviously I am doing something wrong but I can't figure out what.
BTW - I tried Columns.Add("","") also with virtually the same result.