PC Review


Reply
Thread Tools Rate Thread

Databound Combo - How to format date values

 
 
George Padvorac
Guest
Posts: n/a
 
      20th Aug 2003
Im running win2k and .net 1.1 I have a combo who's rowsource is a dataview.
The data being used are date values and this is what it looks like in the
dataset thats used for this dataview: "2003-06-14T00:00:00.0000000-05:00"

And the dates in the combo's list looks like this: 6/14/2003 12:00:00 AM

How can i format the dates in the dropdown list to look like this:
6/14/2003

Thanks.
--
George Padvorac
(E-Mail Removed)


 
Reply With Quote
 
 
 
 
Dmitriy Lapshin [C# / .NET MVP]
Guest
Posts: n/a
 
      21st Aug 2003
Hello George,

You will need to obtain Binding object instance for the combo box. Each
control maintain DataBindings collection which usually contains a single
Binding instance.

Then you should subscribe to the Format and Parse events of this Binding
instance to provide your custom data parsing and formatting.

Or, you may bind your control manually like this:

Binding b = new Binding
("Text", ds, "customers.custToOrders.OrderAmount");
b.Parse += new ConvertEventHandler(CurrencyStringToDecimal);
b.Format += new ConvertEventHandler(DecimalToCurrencyString);
textBox3.DataBindings.Add(b);

(Code snippet taken from MSDN documentation on the DataBindings property).

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Unit Testing and Integration Environment
http://x-unity.miik.com.ua
Deliver reliable .NET software

"George Padvorac" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Im running win2k and .net 1.1 I have a combo who's rowsource is a

dataview.
> The data being used are date values and this is what it looks like in the
> dataset thats used for this dataview: "2003-06-14T00:00:00.0000000-05:00"
>
> And the dates in the combo's list looks like this: 6/14/2003 12:00:00 AM
>
> How can i format the dates in the dropdown list to look like this:
> 6/14/2003
>
> Thanks.
> --
> George Padvorac
> (E-Mail Removed)
>
>


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get a Date to show as a Date Format in Combo Box Jez Microsoft Excel Programming 3 19th Sep 2008 04:33 PM
Can't format a databound date cmay Microsoft ASP .NET 2 7th Mar 2006 12:22 AM
Format Combo values with padding =?Utf-8?B?U2FtYW50aGE=?= Microsoft Access Forms 5 6th Jan 2006 08:27 PM
How can I format date in databound combobox in windows app? George P. Microsoft ADO .NET 4 2nd Dec 2004 02:09 AM
Custom display format for databound combo box Cory Burkhardt Microsoft Dot NET Framework Forms 1 4th Sep 2004 07:54 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:09 PM.