Results 1 to 11 of 11

Thread: Items are many datarows.

  1. #1

    Thread Starter
    Member
    Join Date
    May 2009
    Location
    VietNam
    Posts
    56

    Items are many datarows.

    I have a combobox. And i have a datagridview.
    i want when click combobox it drops datarows of datagridview down.
    How can i do that ! thanks
    Last edited by Nguyendangtruong; May 23rd, 2009 at 07:33 PM.

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

    Re: Items are many datarows.

    you want a dropdown datagridview?

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

    Re: Items are many datarows.

    I assume that you mean that you want the values from one of the columns in the grid to be displayed in the ComboBox. Assuming that your data is bound, you can simply bind the same data to both the grid and the ComboBox. The specify which column to display in the ComboBox using the DisplayMember property:
    vb.net Code:
    1. Me.BindingSource1.DataSource = myList
    2.  
    3. Me.DataGridView1.DataSource = Me.BindingSource1
    4.  
    5. Me.ComboBox1.DisplayMember = "SomeColumn"
    6. Me.ComboBox1.DataSource = Me.BindingSource1
    In that case 'myList' might be a DataTable or any other list you care to bind. "SomeColumn" can be the name of a DataColumn or the name of a property of the items in the list.
    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

  4. #4

    Thread Starter
    Member
    Join Date
    May 2009
    Location
    VietNam
    Posts
    56

    Re: Items are many datarows.

    Thanks Jm. But i am sorry. i mean i need all rows in datagridview or another dataset will drop down when i click combox.
    It means not a column as you mention , i want all columns.
    i am sure it is possible. because i saw that. but i dont know
    thanks.

  5. #5
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: Items are many datarows.

    It is possible, but you would either have to buy it, or make it. If you want to buy it I think ComponentOne had a similar control.

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

    Re: Items are many datarows.

    If you search for multicolumn combobox you will almost certainly find some results. It's been mentioned on this forum many times before. You might also try The Code Project as I'm sure there's at least one example there.
    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

  7. #7

    Thread Starter
    Member
    Join Date
    May 2009
    Location
    VietNam
    Posts
    56

    Re: Items are many datarows.

    Thanks JM.
    It is thing which i need.

  8. #8

    Thread Starter
    Member
    Join Date
    May 2009
    Location
    VietNam
    Posts
    56

    Re: Items are many datarows.

    Is that autocomplete combobox ?
    Last edited by Nguyendangtruong; May 23rd, 2009 at 08:37 PM.

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

    Re: Items are many datarows.

    Quote Originally Posted by Nguyendangtruong View Post
    Is that autocomplete combobox ?
    Did you read about that control? Did that information give any indication of what the control is for? Did it give any indication that it was for displaying multiple 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

  10. #10
    Fanatic Member manhit45's Avatar
    Join Date
    May 2009
    Location
    Ha noi - Viet Nam
    Posts
    826

    Re: Items are many datarows.

    Hi Nguyendangtruong.

    Thanks for this subject. i need it too.
    Last edited by manhit45; May 23rd, 2009 at 09:05 PM.
    --***----------***-----

    If i help you please rate me.

    Working with Excel * Working with String * Working with Database * Working with array *

    K51 ĐH BÁCH KHOA HÀ NỘI - Khoa CNTT pro.

  11. #11

    Thread Starter
    Member
    Join Date
    May 2009
    Location
    VietNam
    Posts
    56

    Re: Items are many datarows.

    Thanks Jm.
    i dont want to say this. but actually you are very wonderful.

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