Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

ItemData of Combobox in .Net

Posted on 2003-02-25
4
Medium Priority
?
296 Views
Last Modified: 2012-08-13
Hi, My questions is, I have Province table with Province Name and Province Code. In VB 6, we had this property ItemData where we can store related value and run query based on that. But in VB.Net, we don't have this kind of property. Can anyone help me out, how can i do this in .Net?

Thanks.
0
Comment
Question by:asimahmed073100
  • 2
4 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 8025354
In .Net, what is actually held in a ComboBox is an Object, not a simple string.  What is displayed in the ComboBox is defined by the Object's .ToString() .

That being the case, if you define the class correctly, you can have almost any data available when you select an Item from the ComboBox.

Yes, that will require that you re-write the part of the code that both stores items in the ComnboBox, and the code that uses the Selected Item.  But the increase in capability will be well worth the necessary re-coding effort.

AW
0
 

Author Comment

by:asimahmed073100
ID: 8025502
Thanks Arthur, but i am just wondering how would i save both items in combobox as i don't want users to see the ProvinceID. One more thing came up in my mind is about DataSet. Could you help me out, where can i get much and detailed information about the DataSet.

Thanks.
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 80 total points
ID: 8035277
you can write your own version of the ToString method of the class used to load the combobox, and thus control what is actually displayed as the entry in the combobox.  Your ToString() method would override the Base Class method.

Does that solve your problem?

AW
0
 

Expert Comment

by:CleanupPing
ID: 9447514
asimahmed:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question