How to Display the Value in the DataGridViewComboBox without having the Item [modified]
-
Hi, I am new to the Visual C#, I have an application where I need to create the Combobox cells in the DatagridViewcolumn. I am able create the Comboboxes dynamically by replacing the DataGridviewTextBoxColumn Cell. The static Data to be updated in the ComboBox is from the dbc File, which can have any number of items. Here let us take 2 items from the dbc file, there is another source in the same datagrid from different column which data should be reflected in the ComboBox Cell but the items shall not be added, the only value shall be displayed in the combobox cell. Please help me:confused:.
modified on Tuesday, August 19, 2008 2:21 PM
-
Hi, I am new to the Visual C#, I have an application where I need to create the Combobox cells in the DatagridViewcolumn. I am able create the Comboboxes dynamically by replacing the DataGridviewTextBoxColumn Cell. The static Data to be updated in the ComboBox is from the dbc File, which can have any number of items. Here let us take 2 items from the dbc file, there is another source in the same datagrid from different column which data should be reflected in the ComboBox Cell but the items shall not be added, the only value shall be displayed in the combobox cell. Please help me:confused:.
modified on Tuesday, August 19, 2008 2:21 PM
Is there a way to Filter the DataGridViewComboBoxCell Items from the Display. Please give any clues.
SomaShekhar
-
Is there a way to Filter the DataGridViewComboBoxCell Items from the Display. Please give any clues.
SomaShekhar
-
Soma Shekhar wrote:
Is there a way to Filter the DataGridViewComboBoxCell Items from the Display.
Yes
Soma Shekhar wrote:
Please give any clues.
You can filter the DataSource[^]
led mike
mike Thanks for your help. Using DataSource, DisplayMember, and ValueMember we can Filter. I have an application where I have a NumericUpDownCell in the Column1 and ComboBox Cell in Column2 both are created Run time. I need to Display what ever the value updating in the NumericUpDownCell in the ComboBox Cell, but when user selects the ComboBox Cell in the Drop Down view only the item from the File needs to be displayed how can I acheive this. Example : I need to Display 0 to 254 in ComboBox Cell when updating the NumericUpdown. When user selects the ComboBox I need to show only 255 rest of the values shall not be shown in the Drop Down list. Please provide a snippet of VC# code :) .
SomaShekhar
-
mike Thanks for your help. Using DataSource, DisplayMember, and ValueMember we can Filter. I have an application where I have a NumericUpDownCell in the Column1 and ComboBox Cell in Column2 both are created Run time. I need to Display what ever the value updating in the NumericUpDownCell in the ComboBox Cell, but when user selects the ComboBox Cell in the Drop Down view only the item from the File needs to be displayed how can I acheive this. Example : I need to Display 0 to 254 in ComboBox Cell when updating the NumericUpdown. When user selects the ComboBox I need to show only 255 rest of the values shall not be shown in the Drop Down list. Please provide a snippet of VC# code :) .
SomaShekhar
-
Soma Shekhar wrote:
Using DataSource, DisplayMember, and ValueMember we can Filter.
No. Using whatever you used for the DataSource you filter the items.
led mike
Hi mike, My application is some thing like threre are 2 datagridviews 1 with main data and the second displays the if any sub items in the main item. sub items can be value range, few selections, true or false type. In the second gridview I have NumericUpDownCell, ComboBox Cell. In the Sub Items there are only 2 values for the comboBox but the range of values can be 0 to 255, so when user selects ComboBox I need to display 0 ("Initial Value") and 255 ("Invalid Value"). When NumericUpdOwn is selected I have to increment/decrement values range from 0 to 255 and the 1 to 254 shall display in the ComboBox. I have done some mimik based on your input but differently. When ComboBox is selected I have removed the rest of the items, if there is no event selectionchanged I have restored the item, but it causes a blank ComboBox for a short duration.
SomaShekhar
-
Hi mike, My application is some thing like threre are 2 datagridviews 1 with main data and the second displays the if any sub items in the main item. sub items can be value range, few selections, true or false type. In the second gridview I have NumericUpDownCell, ComboBox Cell. In the Sub Items there are only 2 values for the comboBox but the range of values can be 0 to 255, so when user selects ComboBox I need to display 0 ("Initial Value") and 255 ("Invalid Value"). When NumericUpdOwn is selected I have to increment/decrement values range from 0 to 255 and the 1 to 254 shall display in the ComboBox. I have done some mimik based on your input but differently. When ComboBox is selected I have removed the rest of the items, if there is no event selectionchanged I have restored the item, but it causes a blank ComboBox for a short duration.
SomaShekhar
-
I'm having a difficult time understanding what your requirements are. For this reason I cannot suggest a specific solution. However in general, for cases that might require more complicated behavior a custom column might be a good solution.
led mike
Mike, Thanks for your guidence, I will check it out, mean while what i did was I have added a Item when the value is changed in the Numericupdowncell and removed when combobox is selected. Now it is working fine.
SomaShekhar