473,839 Members | 1,330 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 10962

"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
1371
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
1009
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
953
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
8510
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
1256
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
836
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
2502
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
2238
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
9697
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
10908
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
10587
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10295
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
9426
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...
1
7829
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7018
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4064
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.