[RESOLVED] datagridview Combo filling
I have a dataGridView in my program that displays stuff .
http://img198.imageshack.us/img198/3...eenshotdjg.jpg
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
Re: datagridview Combo filling
You want to fill a field data to combobox ???
Re: datagridview Combo filling
thx 4 replying
I wanna fill the combobox which is inside the datagridview
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.
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
http://img213.imageshack.us/img213/6...eenshotlby.jpg
2. And I dont know the correct method to detect the datagrid combobox value changed
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.
Re: datagridview Combo filling
Quote:
presented with a list of invoices to choose from, probably in a dialogue
this idea is ok :rolleyes: then How to pass a object between two MDI child forms ! ?
Re: datagridview Combo filling
Quote:
Originally Posted by
nVidia
this idea is ok :rolleyes: 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.
Re: datagridview Combo filling
It works but I used a module pass data between forms
thx !!!