Results 1 to 9 of 9

Thread: [RESOLVED] datagridview Combo filling

  1. #1

    Thread Starter
    Junior Member nVidia's Avatar
    Join Date
    Dec 2008
    Posts
    22

    Resolved [RESOLVED] datagridview Combo filling

    I have a dataGridView in my program that displays stuff .



    The invoice No column has a combo box
    what I wanna do is when the form loads the All the invoice No's which r in the DB should be loaded into the combo box

    When I select the Invoice No using the combo box the rest should fill

    this is what I did --
    In form load wrote a code to fill the combo it din work
    I tried but the combo box didnt fill
    And the combo box dropdown also didnt work


    In normal combo I use
    Code:
    ComboBox1_SelectionChangeCommitted
    but in the datagrid combo what should I use ?

    If can please help me ?
    --
    thx
    nVidia
    I am a newbee for .net

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

    Re: datagridview Combo filling

    You want to fill a field data to combobox ???
    --***----------***-----

    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.

  3. #3

    Thread Starter
    Junior Member nVidia's Avatar
    Join Date
    Dec 2008
    Posts
    22

    Re: datagridview Combo filling

    thx 4 replying
    I wanna fill the combobox which is inside the datagridview

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

    Re: datagridview Combo filling

    That doesn't really make sense. If that was a standard ComboBox and a bunch of TextBoxes then I could understand it. You'd use the ComboBox to select the record and then edit the fields in the TextBoxes. In a DataGridView it doesn't really make sense to populate the row based on the combo box selection though. In a grid you should be displaying all the records together at the same time. The combo box should be used for editing the field in that column by setting it to one of a finite list of values. I think you need to rethink your design.
    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

    Thread Starter
    Junior Member nVidia's Avatar
    Join Date
    Dec 2008
    Posts
    22

    Re: datagridview Combo filling

    • my purpose isnt editing purpose is adding
    • A list of invoice No's already there in the db
    • Now what wanna do is I Click the Add button in my form then
    • A new row will appear like shown in the image (first post image)
    • now once I select the invoice No from the datagridcombo box the other fields will be filled and a reocrd will be inserted to another table
    • Next If I wanna insert another record agan I will click the datagridcombo box and select the invoice no now again the fields will be filled and a reocrd will be inserted to another table like this I wanna DO


    The problems I face
    1. the combo box isnt getting filled IF i use this method


    2. And I dont know the correct method to detect the datagrid combobox value changed
    Last edited by nVidia; Jul 16th, 2009 at 01:17 AM.

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

    Re: datagridview Combo filling

    Your UI still doesn't make sense. The ComboBox shouldn't be in the grid. When you click the Add button the user should be presented with a list of invoices to choose from, probably in a dialogue, maybe in a grid or maybe in a set of controls with a single ComboBox and multiple TextBoxes or Labels. Once the user makes a selection, the data from the selected row should be added to the grid, which will contain all text box 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

  7. #7

    Thread Starter
    Junior Member nVidia's Avatar
    Join Date
    Dec 2008
    Posts
    22

    Re: datagridview Combo filling

    presented with a list of invoices to choose from, probably in a dialogue
    this idea is ok then How to pass a object between two MDI child forms ! ?

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

    Re: datagridview Combo filling

    Quote Originally Posted by nVidia View Post
    this idea is ok then How to pass a object between two MDI child forms ! ?
    It wouldn't be two MDI child forms. The user should be making a selection from a modal dialogue. You would call ShowDialog and once it returns you can get property values and/or call methods of the dialogue to get the data you need.
    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

  9. #9

    Thread Starter
    Junior Member nVidia's Avatar
    Join Date
    Dec 2008
    Posts
    22

    Re: datagridview Combo filling

    It works but I used a module pass data between forms
    thx !!!

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