Datagridview -- Won't Clear

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QXJuZSBCZXJ1bGRzZW4=?=

    #1

    Datagridview -- Won't Clear

    I have a DGV (vb.net 2005). The user has the option to search by City,
    State, Name...etc.

    I can't get the DGV to clear between searches. The first search (city for
    example) works fine. But if I change it to State...the results are
    correct...but the City column still exists and the State Column has been
    added to the end.

    I've tried clearing rows, columns, and setting the datasource to nothing
    before starting again...but the DGV seems to retain the previous column
    settings.

    Any suggestions?

    Arne
  • RobinS

    #2
    Re: Datagridview -- Won't Clear

    Bind it to a binding source. Then when you change the data source, the
    Binding Source will handle the changes to the grid.

    myBindingSource .DataSource = myTable
    myDGV.DataSourc e = myBindingSource

    Robin S.
    Ts'i mahnu uterna ot twan ot geifur hingts uto.
    ----------------------------------------------------------
    "Arne Beruldsen" <ArneBeruldsen@ discussions.mic rosoft.comwrote in message
    news:278D72E7-59D5-4D59-9082-83366B02B17A@mi crosoft.com...
    >I have a DGV (vb.net 2005). The user has the option to search by City,
    State, Name...etc.
    >
    I can't get the DGV to clear between searches. The first search (city
    for
    example) works fine. But if I change it to State...the results are
    correct...but the City column still exists and the State Column has been
    added to the end.
    >
    I've tried clearing rows, columns, and setting the datasource to nothing
    before starting again...but the DGV seems to retain the previous column
    settings.
    >
    Any suggestions?
    >
    Arne

    Comment

    Working...