c# - How do I use Format on items in combobox

  • Thread starter Thread starter Orr
  • Start date Start date
O

Orr

Hi
I have a combobox with data source from dataset.
I recieve the data in Decimal and I want to present it in Hex.

example:


myCmb.DataBindings.Clear();
myCmb.DataSource = myDataset.myDataable;
myCmb.DisplayMember = "myColumnName";
myCmb.ValueMember = "myColumnName";

I tried to use Format() but the combobox doesnt have this property. it
doesnt work on the combo box.
I am a begginer programmer so I will thank you for a simple
explanation.
Thanks, Orr
 
Hi
I have a combobox with data source from dataset.
I recieve the data in Decimal and I want to present it in Hex.

example:


myCmb.DataBindings.Clear();
myCmb.DataSource = myDataset.myDataable;
myCmb.DisplayMember = "myColumnName";
myCmb.ValueMember = "myColumnName";

I tried to use Format() but the combobox doesnt have this property. it
doesnt work on the combo box.
I am a begginer programmer so I will thank you for a simple
explanation.
Thanks, Orr

I looked for away to format in an event, but did not find one.

You will probably have to use a datareader to loop through the database rows and
add the items to the combobox one at a time after formatting them.

Why do you need to format the items? Are you putting numeric values in a combo
box to be chosen by the user? How will you use the items in the ComboBox?

ComboBox controls are typically used for picking and choosing items from a list
of known values. If you're loading numeric values into one for this type of
activity, you might find that another type of control is a better fit.

Tell us more about what you are trying to accomplish.
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
I might try an expression in the SELECT that returns properly formatted
value.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
 
Back
Top