473,800 Members | 2,529 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SelectionBox + dataset confusion

I have an dataset that populates a selectionbox. I'd like to get the
value of the column "id" of the selected item in the selectionbox
afterwards. How would I do this?
Jun 27 '08 #1
3 1101
"SelectionB ox"? I've never heard of such a control. Probably you mean one of
the List derived controls like ListBox or dropdownList, etc. These usually
have a property called SelectedValue which would represent the ID vs.
SelectedText representing what the user "sees" when they make a selectio.
-- Peter
To be a success, arm yourself with the tools you need and learn how to use
them.

Site: http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://ittyurl.net
"sweetiecak es" wrote:
I have an dataset that populates a selectionbox. I'd like to get the
value of the column "id" of the selected item in the selectionbox
afterwards. How would I do this?
Jun 27 '08 #2
Yes, sorry, I accidently confused the name. I mean a ComboBox. But I
want this ID to be consistent with the database one. How would I do this?

Peter Bromberg [C# MVP] wrote:
"SelectionB ox"? I've never heard of such a control. Probably you mean one of
the List derived controls like ListBox or dropdownList, etc. These usually
have a property called SelectedValue which would represent the ID vs.
SelectedText representing what the user "sees" when they make a selectio.
-- Peter
To be a success, arm yourself with the tools you need and learn how to use
them.

Site: http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://ittyurl.net
"sweetiecak es" wrote:
>I have an dataset that populates a selectionbox. I'd like to get the
value of the column "id" of the selected item in the selectionbox
afterwards. How would I do this?
Jun 27 '08 #3
If you are databinding the control from a DataSource (DataSet, DataTable,
DataReader) that comes out of the database, you need to set the ValueMember
and the DisplayMember properties of your comboBox to the names of the ID
column and the display text column in your datasource.
-- Peter
To be a success, arm yourself with the tools you need and learn how to use
them.

Site: http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://ittyurl.net
"sweetiecak es" wrote:
Yes, sorry, I accidently confused the name. I mean a ComboBox. But I
want this ID to be consistent with the database one. How would I do this?

Peter Bromberg [C# MVP] wrote:
"SelectionB ox"? I've never heard of such a control. Probably you mean one of
the List derived controls like ListBox or dropdownList, etc. These usually
have a property called SelectedValue which would represent the ID vs.
SelectedText representing what the user "sees" when they make a selectio.
-- Peter
To be a success, arm yourself with the tools you need and learn how to use
them.

Site: http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://ittyurl.net
"sweetiecak es" wrote:
I have an dataset that populates a selectionbox. I'd like to get the
value of the column "id" of the selected item in the selectionbox
afterwards. How would I do this?
Jun 27 '08 #4

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

Similar topics

11
16384
by: Nikki | last post by:
Is it possible to sort a dataset rather than a dataview? I have a web service that returns a dataset which I would like to sort before returning it (this is so the sorting is standardised and so applications that see the results as xml don't have to fiddle around and sort it themselves later). I have tried sorting a dataview and adding that dataview's table to the dataset but the results don't remain sorted. The only way I can see to do...
4
444
by: Andrew Carlson | last post by:
I have a class that performs a few methods on a dataset. That dataset then fills a grid on a form. What I would like to do is to assign a particular dataset to the class at runtime. For instance, if I have 5 datasets named dataset1 through dataset5, how can I call the class from my form, pass the dataset I want to manipulate and then bind that dataset to a datagrid on the form? Each dataset will bind to its own datagrid. Any ideas?
35
2134
by: MuZZy | last post by:
Hi All, I got a issue here and hope someone can help me: Let's consider this code: // =================== CODE START ================================= using System; using System.Data; namespace TestNamespace {
9
2272
by: Dave | last post by:
Compilier will not recognize DataSet object. As you can see below is from a test simple form with no other code. I'm just trying to get any Aspx form to recognize the DataSet object. You can see from the code I am importing System.Data.SqlClient. I can get to DataReader, DataView and DataTable but Visual Studio won't even bring up DataSet on Intellisense, much less compile it. The message I get is: "Reference required to assembly...
2
1144
by: Steve | last post by:
Hello, Here is my scenario. I have a MDIForm, and 2 Child forms (ChildForm1 and ChildForm2). The child forms can only be opened by their own toolbar icon on the MDIForm. When I open ChildForm1, I have a datagrid that I may want to search for a specific record from time to time. When I want to search for a record, I click on the toolbar for ChildForm2 which basically gives me a textbox for input. Once I click the OK button on ChildForm2, I...
2
945
by: Rob Richardson | last post by:
Greetings! I have a database with a table named Holdings. I has VB.Net create a .xsd file for it so that I could use a typed dataset with it. The table has 21 rows. If I use ordinary datasets, I get a DataTable object with 21 rows. If I use a typed dataset, I get a HoldingTable object with 0 rows. What am I doing wrong? Here's the code: Dim holdingsAdapter As New OleDbDataAdapter() Dim holdingsSet As New HoldingsDataSet()
22
25607
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to compile. <WebMethod()> _ Public Function VerifySku(ByVal skus As XmlDataDocument) As DataSet Test program : Dim cartSet As DataSet cartSet = ws.VerifySku(cartSet)
12
5317
by: Whoever | last post by:
Hi, I'm trying to return an XmlDocument or XmlNode converted from a typed dataset. public XmlNode whatever() { MyTypedDataSet ds = new MyTypedDataSet(); return new XmlDataDocument(ds); }
1
3181
by: Richard Lewis Haggard | last post by:
I'm having a problem with what appears to be some sort of confusion with references. I have a single solution with a dozen projects which has been working quite nicely for a while. The references between projects in the solution were established through project references, not by browsing to an assembly DLL. All of the projects are strongly named and use key files. Each project's AssemblyInfo.cs specifies the assembly version, where the...
0
9690
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
10274
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
10033
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
9085
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
7576
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
6811
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
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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
3
2945
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.