474,045 Members | 41,436 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "DataRowVie w" 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 10980

"ASP Yaboh" <AS******@discu ssions.microsof t.com> wrote in message
news:E6******** *************** ***********@mic rosoft.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 "DataRowVie w" 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.Selected Index].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
1383
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 multi-select, but the way the listbox seems to be set up in C#, the SelectedItem member is just the first item in the collection of all selected items, and it may not be the
1
1158
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 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...
0
1019
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 = theOwner.Menu.MenuItems(0) Dim the1 As MenuItem = theOwner.Menu.MenuItems(1) Dim theItems As MenuItem() ReDim theItems(1)
2
959
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
8519
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 mode) so that I the dropdown shows the Item Descriptions, but returns the Item ID number when selected. Completely easy in ASP.NET, but I cannot figure out how to do the same in a Windows Forms app. Obviously the Windows Forms ComboBox is a lot more...
2
1262
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 IF statement.
0
841
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 code, I am very new to this... What I want to do is get the clusterID from the datatable that was selected by the user and I want to pass that clusterID into a function. Am I even on the right path?? Any help is appreciated! Thanks
4
2512
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 The combobox's datasource is an SQL database table column. Mycmb.DataBindings.Add(New Binding("Text", BindingSource1, "ColName")) Basically, I want to search the database table depending on whatever is selected in the combobox and pass...
1
2253
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 1">A</option> <option value="Item 2">B2</option> <option value="Item 3">C</option> </select>
0
10546
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10337
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
12140
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11141
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6837
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5416
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 we have to send another system
2
4944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3971
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.