Results 1 to 7 of 7

Thread: Datagrid view both Combobox AND Autofilter

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2016
    Location
    South Africa
    Posts
    142

    Datagrid view both Combobox AND Autofilter

    Using VB.Net, I would like to know if a datagridview column can be set in the designer to both a Combobox AND an Autofilter type?

    Regards

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

    Re: Datagrid view both Combobox AND Autofilter

    What's an Autofilter type column? That doesn't sound like something that the DataGridView does out of the box. Please provide a full and clear explanation of the problem.
    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
    Nov 2016
    Location
    South Africa
    Posts
    142

    Re: Datagrid view both Combobox AND Autofilter

    I have referenced a .dll called DataGridViewAutoFilter.dll.

    I then have an option to set the datagridview's column type to DataGridViewAutoFilterTextBoxColumn.

    When I run the application, I have a down arrow in the datagridview column header.

    Other columns are of type combobox. My question is whether it is possible to have those combobox columns also autofilter types?

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

    Re: Datagrid view both Combobox AND Autofilter

    They are two different types. One thing cannot be two different types at the same time. What you can do is create a new type that includes the functionality of the other two types.

    Given the name DataGridViewAutoFilterTextBoxColumn, I would guess that it inherits from DataGridViewTextBoxColumn and adds some extra functionality. You could probably derive a new class from DataGridViewComboBoxColumn and add that same functionality and name it DataGridViewAutoFilterComboBoxColumn.
    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

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

    Re: Datagrid view both Combobox AND Autofilter

    Quote Originally Posted by jmcilhinney View Post
    One thing cannot be two different types at the same time.
    Before someone points out that that is not strictly true, I'm talking about the run time type of an object. I'm not talking about base types or interfaces.
    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

  6. #6
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: Datagrid view both Combobox AND Autofilter

    Quote Originally Posted by GideonE View Post
    I have referenced a .dll called DataGridViewAutoFilter.dll.
    Do you have access to the code of that .dll?

  7. #7
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    384

    Re: Datagrid view both Combobox AND Autofilter

    Quote Originally Posted by jmcilhinney View Post
    What's an Autofilter type column? That doesn't sound like something that the DataGridView does out of the box.
    Indeed. First thing comes in my mind is "AutoFilterRow" (not column) which was provided by DevExpress exclusively for their "DataGridView" control, the "GridControl" as a built-in feature. Automatically connected to your db and does queries as shown:
    Name:  automaticfilterrow9952.png
Views: 258
Size:  5.7 KB

    So GideonE, If you've seen GridControl benefits but it is difficult to work with and you want to switchover back to DataGridView, I'm afraid you should write them down.

Tags for this Thread

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