How do you format a date in a ComboBox?

  • Thread starter Thread starter aualias
  • Start date Start date
A

aualias

I have a combobox that displays dates. They display in a long form, but I
would like mm/dd/yyyy. If this were a TextBox, then I would use the
Format() method of the Binding.

The ComboBox is getting bound like this...
cbDate.DataSource = theTable
cbDate.DisplayMember = "theDate"
cbDate.ValueMember = "theDate"

How do I control what gets displayed in the ComboBox?

Thanks.

David
 
Hi David,

You could probably do it an easier way, but if noone has a better solution, there is always OwnerDraw. All formatting then is done in whatever way you want in the drawing process.
 
Hmmmm...

I was hoping for an easier way. I could add a column to the DataTable and
put in the formatted date, but I was hoping for something a bit cleaner -
more like Format() and Parse().

David
 
Back
Top