Results 1 to 9 of 9

Thread: Clearing Data Grid

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    35

    Clearing Data Grid

    Version: 2003
    The datagrid processing works. The problem is that when I make a second selection to populate the data grid, the existing data does not get cleared. I have tried clearing the table, clearing the select command statement, and various other techniques. Nothing works.

    Does anybody have any ideas.

    Thanks in advance.

  2. #2
    Frenzied Member dolot's Avatar
    Join Date
    Nov 2007
    Location
    Ancient City, U.S.
    Posts
    1,254

    Re: Clearing Data Grid

    Have you tried calling Refresh on the datagrid after refreshing the data?
    I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
    My war with a browser-redirect trojan

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    35

    Re: Clearing Data Grid

    Mr Dolot,
    dgECLLines.TableStyles.Clear()
    dgECLLines.Refresh()
    dgECLLines.TableStyles.Add(aGridTableStyleECLLines)
    dgECLLines.DataSource = ds
    dgECLLines.DataMember = "ECLL02"

    As you can see, the refresh is there, but still does not clear. I am open to any suggestions.

    Thanks for Trying.

  4. #4
    Frenzied Member dolot's Avatar
    Join Date
    Nov 2007
    Location
    Ancient City, U.S.
    Posts
    1,254

    Re: Clearing Data Grid

    I would try putting the refresh after the setting of the dataMember.
    I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
    My war with a browser-redirect trojan

  5. #5

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    35

    Re: Clearing Data Grid

    Made the change- same results - added the items from second requested to bottom of first request.

    dgECLLines.TableStyles.Clear()
    dgECLLines.TableStyles.Add(aGridTableStyleECLLines)
    dgECLLines.DataSource = ds
    dgECLLines.DataMember = "ECLL02"
    dgECLLines.Refresh()

  6. #6
    Frenzied Member dolot's Avatar
    Join Date
    Nov 2007
    Location
    Ancient City, U.S.
    Posts
    1,254

    Re: Clearing Data Grid

    And this is the same code that gets called the first time and it works, but not the second time?
    I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
    My war with a browser-redirect trojan

  7. #7

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    35

    Re: Clearing Data Grid

    I set the table in a different data set and I changed the order of the statements and that seems to have solved the problem.

    Thanks for the help.

  8. #8
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Clearing Data Grid

    You do realize that all you are clearing is the table style... not the data, right? Best way I found to get it to clear is to set the DataSource to nothing, call grid.rows.clear, then reset the dataasource, the datamember (although I'm usually jsut binding a datatable, making this moot) and calling .Refresh.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  9. #9

    Thread Starter
    Member
    Join Date
    Nov 2005
    Posts
    35

    Re: Clearing Data Grid

    Yes is do realize the I am clearing the table style. Part of the code that I did not send you was dealing with the table style.

    I really appreciate all you time.

    Thanks again

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