?
Solved

ItemData of Combobox in .Net

Posted on 2003-02-25
4
Medium Priority
?
293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
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 …
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 …
Progress

762 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