473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

display one string and store another in same combobox item

VMI
Is it possible to display something in a combobox and store something else?

For example, can I display "Query for active employees" and save the actual
query in the same combobox item? That way I can automatically retrieve the
specific query for the option the user chose.

Is this possible?

Thanks.
Nov 17 '05 #1
2 1305
mdb
"VMI" <vo******@yahoo.com> wrote in
news:e3**************@TK2MSFTNGP15.phx.gbl:
Is it possible to display something in a combobox and store something
else?

For example, can I display "Query for active employees" and save the
actual query in the same combobox item? That way I can automatically
retrieve the specific query for the option the user chose.


If this is an object class that you have defined, then you can override the
ToString() method and that is what will display in the comboBox. For
example:

public class MyQuery
{
... Your Query Definition ...
public string QueryName = "Query for active employees";

public override string ToString()
{
return QueryName;
}
}

--
-mdb
Nov 17 '05 #2
Hi,

As mdb said, you can create your own class and override ToString, or you can use store your queries in a DataSource and specify DisplayMember and ValueMember.
On Fri, 29 Jul 2005 23:59:26 +0200, VMI <vo******@yahoo.com> wrote:
Is it possible to display something in a combobox and store something else?

For example, can I display "Query for active employees" and save the actual
query in the same combobox item? That way I can automatically retrieve the
specific query for the option the user chose.

Is this possible?

Thanks.


--
Happy coding!
Morten Wennevik [C# MVP]
Nov 17 '05 #3

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

Similar topics

1
by: Dan Keeley | last post by:
Hi I'm trying to create a custom combo box so i can display a nice text name but return the actual key value for the database. So i have this class ( At the bottom of this post ) How do i...
4
by: Keith | last post by:
Hello - this started out as a minor annoyance - and now is starting to bother me more and more - I'm hoping someone can help me. I would like to have a combobox display - NOT initially be blank...
2
by: Mamatha | last post by:
Hi I want to add an icon to the textbox's text. I don't know how to display icon in textbox in VB.NET. If any one knows please let me know. Thanks in advance. Mamatha
2
by: kurtzky | last post by:
i created a form that should function as follows: i will enter a number in a textbox..then it should query from the database all the records which has that number..these records will have a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...

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.