Results 1 to 3 of 3

Thread: [RESOLVED] datagridview remove columns

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2009
    Posts
    230

    Resolved [RESOLVED] datagridview remove columns

    I've got a DataGridview I want to remove columns from as it greatly increases performance when I format the DGV.

    The first time I remove columns in a loop (using the removeat) property, everythings fine. But when I try to remove more columns in another loop, it appears to remove the wrong columns and displays the wrong data. In other words, it displays the wrong data and headers; and the columns it does show has headers and cells that don't match.

    I've debugged this to death and I can't see a problem with the logic in the code so I guess it must be a bug with the system. Is there any way around this?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: datagridview remove columns

    You're obviously using the wrong indexes. The exact issue eludes me because I can't see your code but I would assume that you're using indexes that were correct to begin with but are now incorrect since you've already removed other columns.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2009
    Posts
    230

    Re: datagridview remove columns

    No, this isn't the case as I remove the indexes, which I've stored in an arraylist, in reverse order:

    Code:
            a.Reverse()
            For i = 0 To a.Count - 1
                cols.removeat(a(i))
            Next

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