Results 1 to 3 of 3

Thread: how to clear a data gridview

  1. #1

    Thread Starter
    Member
    Join Date
    May 2007
    Posts
    60

    how to clear a data gridview

    Hi there
    I want to clear my datagridwew without resizing it , i mean that i want to have the same number of rows and collumns , i just want to have emptu cells
    how can we do that
    thank you

  2. #2
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    Re: how to clear a data gridview

    Hello,

    How have you binded your datagridView?

    To keep the same number of columns you should set the binding source to nothing.

    If you have set the dgv to a binding source, then set the binding source's datasource to nothing.

    Code:
    mybindingSource.DataSource = nothing
    steve

  3. #3
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fox, OK
    Posts
    381

    Re: how to clear a data gridview

    Maybe something like this?
    vb Code:
    1. r = DataGridView.RowCount
    2. DataGridView.Rows.Clear
    3. DataGridView.RowCount = r

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width