473,418 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Getting SelectedText/Item from ComboBox

I have a WinForm ComboBox that is populated by binding to a dataset that
contains a list of employees (two columns: 1. employee id, 2. employee name).
The id is bound to the ValueMember, the name to the DisplayMember. The
dataset is then disposed.

When an item is selected from the combobox, the value is easy to get. Yet
when I try to capture the selected text I get a "DataRowView" back. I've
tried to work my way through the DataRowView but I keep hitting a wall. Is
there a simple way to access the selected DisplayMember? It shouldn't be this
difficult.

Thank you
Nov 17 '05 #1
1 10931

"ASP Yaboh" <AS******@discussions.microsoft.com> wrote in message
news:E6**********************************@microsof t.com...
I have a WinForm ComboBox that is populated by binding to a dataset that
contains a list of employees (two columns: 1. employee id, 2. employee
name).
The id is bound to the ValueMember, the name to the DisplayMember. The
dataset is then disposed.

When an item is selected from the combobox, the value is easy to get. Yet
when I try to capture the selected text I get a "DataRowView" back. I've
tried to work my way through the DataRowView but I keep hitting a wall. Is
there a simple way to access the selected DisplayMember? It shouldn't be
this
difficult.

Thank you


Isn't it something like:

cboBox.Items[cboBox.SelectedIndex].Text

??

HTH,
Mythran

(P.S. Not sure, I haven't created winform app in a long time)

Nov 17 '05 #2

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

Similar topics

0
by: E Miller | last post by:
Visual Studio .NET 2002 I've got an application in which I need to be able to click on a listbox item to initiate a dialog pertaining to that item. I'd like to be able to keep the dialog...
1
by: ASP Yaboh | last post by:
I have a WinForm ComboBox that is populated by binding to a dataset that contains a list of employees (two columns: 1. employee id, 2. employee name). The id is bound to the ValueMember, the name...
0
by: Schorschi | last post by:
Ok the following works... but is ugly and static, need the same idea but dynamic, so as the 'theOwner' form main menu is defined, NotifyIcon.ContextMenu can be updated. Dim the0 As MenuItem =...
2
by: Jozef Jarosciak | last post by:
Hey guys, I have a listview with 7 collumns and I need to retrieve value from the first line and its 7th collumn. Is there an easy way to retrieve it? Thanks, Joe
4
by: Joe Schmoe | last post by:
All I want to to be able to take a two-column DataReader (One column with the Item ID number, the other with Item Description text) and load it into a Windows Forms ComboBox (Set to DropDownList...
2
by: deanfamily | last post by:
I have a character array that I am using to get the user's input. I only want to get out of the array grouping symbols (,),{or}. Is there a way for me to do this? I am currently trying to use an...
0
by: JLC | last post by:
I want to get one item out of a datatable, but when I click on the row I am getting an error that says: IndexOutOfRange Exception. There is now row at position x (whatever row I clicked) Here's my...
4
by: rang1 | last post by:
Hi, My VB.Net 2005 application is throwing the following exception when I try to retrieve the selected item from a combobox. Conversion from type 'DataRowView' to type 'String' is not valid ...
1
by: gubbachchi | last post by:
Hi, How can I get the selected item of the drop down box into a php variable in the same page. The options in drop down box are A,B and C and the code is here <select> <option value="Item...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.