Inherits DataGridView Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul

    #1

    Inherits DataGridView Problem

    I created a class that inherits from the DataGridView. In the New Sub
    I want it to initialize with 3 columns. When I place the inherited
    class on a form, it's work great. The three columns are created.
    Then, if I close the Form view and reopen it, the inherited class
    control has 6 columns. The three columns I wanted are added again. I
    try to clear the columns prior to adding them, but it doesn't seem to
    work. Below is the code.

    Any help would be greatly appreciated!

    Public Class ChecksReceivedD ataGridView
    Inherits DataGridView

    Public Sub New()
    MyBase.New()

    Me.Rows.Clear()
    Me.Columns.Clea r()
    Me.ColumnCount = 0
    Me.Columns.Add( "colAmount" , "Amount")
    Me.Columns.Add( "colEnteredDate ", "Date")
    Me.Columns.Add( "colSource" , "Source")
    End Sub

    End Class

Working...