473,506 Members | 17,176 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get selectedItem in DatagridviewComboBoxCell

I have a DatagridviewComboBoxCell with self added object (with an id and a
string field) as items to the DatagridviewComboBoxCell.

Dim cboCell As New DataGridViewComboBoxCell
cboCell.Items.Add(new MyObj(1,"Item 1"))
cboCell.Items.Add(new MyObj(2,"Item 2"))
cboCell.Items.Add(new MyObj(3,"Item 3"))

But I cannot find a method from DataGridViewComboBoxCell
to get back the selected MyObj in the cboCell list.
I suppose there should be a selectedItem property as in a comboBox control
but it doesn't have.

Please help !!!

Sep 12 '06 #1
1 23618
I've solve the get selectedItem by the approach in
http://msdn2.microsoft.com/en-us/library/ms404353.aspx

But another problem is cannot set a selected item for
DatagridviewComboBoxCell.
I can only set the value (displayed) for DatagridviewComboBoxCell, but
cannot not
set my predefined item (id, string) in the DatagridviewComboBoxCell.

"hangdee" wrote:
I have a DatagridviewComboBoxCell with self added object (with an id and a
string field) as items to the DatagridviewComboBoxCell.

Dim cboCell As New DataGridViewComboBoxCell
cboCell.Items.Add(new MyObj(1,"Item 1"))
cboCell.Items.Add(new MyObj(2,"Item 2"))
cboCell.Items.Add(new MyObj(3,"Item 3"))

But I cannot find a method from DataGridViewComboBoxCell
to get back the selected MyObj in the cboCell list.
I suppose there should be a selectedItem property as in a comboBox control
but it doesn't have.

Please help !!!
Sep 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3013
by: Moshazu | last post by:
I am attempting to use the DataGridView control in my software and have not been able to easily find answers to a couple of questions that I have. 1. Is the only way to change the data in a...
0
3048
by: Jay | last post by:
I am using Windows .Net 2.0 SDK I have a DataGridView control in a windows form. None of my controls are databound prior to run time. I am creating a string array with which I want to populate...
2
8814
by: kofteros | last post by:
I have a DataGridView in which one of its columns is a DatagridViewCombobox. This column contains values as 1. "ROAMING" 2. "MOBILE" 3. "TELEPHONY"... I want to select an index from this...
1
6432
by: aXqd | last post by:
i want a editable comboboxcell for a datagridview, i have done these: public partial class Form1 : Form { .... private static List<string_tempList = new List<string>(new string {}); ....
0
2125
by: Bruno Neves Pires Silva | last post by:
Hello, everybody. How can I get the selected item index in a DataGridViewComboBoxCell, in a datagridview?
0
3373
by: news.microsoft.com | last post by:
Hello- I'm having a dickens of a time trying to set the value on a DataGridViewComboBoxColumn. I actually have two DataGridViewComboBoxColumns in my datagrid view. First, I'm setting up the...
0
2845
by: =?Utf-8?B?R2FkeUM=?= | last post by:
HI I populate one col. in a dataiewgrid with a combocell as DataGridViewComboBoxCell. (create on the fly and assign it to cell) I need to avid arrow user's up/down on that cells. All the grid...
1
3230
by: JB | last post by:
Hi All, Is there a way to programmatically open the drop down list of a DataGridViewComboBoxCell? Thanks JB
4
2701
by: Martin Horst | last post by:
Hi, I've got a Windows Form DataGridView with several DataGridViewComboBoxCell columns. The Items collection of the DataGridViewComboBoxCell can take any kind of objects. But when the user...
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7103
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4701
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.