|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
c# - How do I use Format on items in comboboxHi
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
Show quote
On 5 Dec 2006 12:59:42 -0800, "Orr" <orrrach***@gmail.com> wrote: I looked for away to format in an event, but did not find one.>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 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. -- Show quote____________________________________ 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) ----------------------------------------------------------------------------------------------------------------------- "Otis Mukinfus" <ph***@emailaddress.com> wrote in message news:jrbdn2d6oqceg5ukknkj8j5a6gl6nr3v4d@4ax.com... > On 5 Dec 2006 12:59:42 -0800, "Orr" <orrrach***@gmail.com> wrote: > >>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 On Wed, 6 Dec 2006 08:53:56 -0800, "William \(Bill\) Vaughn"
<billvaRemoveT***@nwlink.com> wrote: >I might try an expression in the SELECT that returns properly formatted Yep, that would work, if the OP can deal with a string. I guess even if they>value. can't they can convert it to the original type after they take it out of the ComboBox. Good luck with your project, Otis Mukinfus http://www.arltex.com http://www.tomchilders.com |
|||||||||||||||||||||||