|
-
Jun 10th, 2010, 01:55 PM
#1
Thread Starter
Junior Member
Formatting a combo box to include a heading.
Greetings everyone,
Is there a way to format a combo box so that the data returned from the database can have a heading. Example:
ID Name
1 Franks
2 Jane
So basically, programming in the heading information before the data is returned. The only data return from the database is ID numbers and Names, not the heading. Lastly, I did not to use a Rich Textbox because the user needs to make a selection in order to perform deletion. Thank in advance.
-
Jun 10th, 2010, 02:43 PM
#2
Re: Formatting a combo box to include a heading.
 Originally Posted by franconomic
Greetings everyone,
Is there a way to format a combo box so that the data returned from the database can have a heading. Example:
ID Name
1 Franks
2 Jane
So basically, programming in the heading information before the data is returned. The only data return from the database is ID numbers and Names, not the heading. Lastly, I did not to use a Rich Textbox because the user needs to make a selection in order to perform deletion. Thank in advance.
What is your query for the database?
-
Jun 10th, 2010, 03:09 PM
#3
Thread Starter
Junior Member
Re: Formatting a combo box to include a heading.
The query is select * all. Then I just simply selected to use the columns that I want to use...
-
Jun 10th, 2010, 03:11 PM
#4
Re: Formatting a combo box to include a heading.
 Originally Posted by franconomic
The query is select * all. Then I just simply selected to use the columns that I want to use...
This is a bad practice. If you don't need all the data, why query for all? It's a waste of resources.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Jun 10th, 2010, 03:12 PM
#5
Re: Formatting a combo box to include a heading.
Doesn't make a lot of sense... if the header gets displayed in the combo, it bcomes selectable... plus, does the user really need to see the ID? I would think they would be more interested in the name part. I would set the displaymember to the name, the valuemember to the id, then set the combo's datasource to your datatable... then the user gets the very nice name Col in the display... and you get the ID value when using the .Value property.
-tg
-
Jun 10th, 2010, 03:13 PM
#6
Re: Formatting a combo box to include a heading.
Comboboxes are not designed to display tabular data. If you want to show your data in tabular format, use another control that is more suited, such as a datagridview.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Jun 10th, 2010, 03:19 PM
#7
Re: Formatting a combo box to include a heading.
Normally I'd agree... but I have seen (and used) multi-column drop downs before... they are handy when you need them... but this is a case where it's not needed.
-tg
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|