Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2004

Tip: Looking for answers? Try searching our database.

Formatting Bound ComboBox with DateTime

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Adams - 07 Jul 2004 05:30 GMT
Hi,

I have a bound ComboBox  that has a DateTime field for the DisplayMember.  I
only want the date to show instead of the date and time (always 12:00 AM).
Is it possible to format the DisplayMember property of the ComboBox?

Thanks,

David Adams
Ken Tucker [MVP] - 07 Jul 2004 12:47 GMT
Hi,

       You would have to make a ownerdrawn combobox.

Ken
---------------------
> Hi,
>
[quoted text clipped - 6 lines]
>
> David Adams
Jim-M - 07 Jul 2004 18:07 GMT
You didn't state what the datasource was...but if you can override the
ToString method on the datasource to return just the date part, that's
one option.  In the past I've also created a duplicate column on the
datasource (in cases where there's not much data and this isn't a
problem) of type String and initialized to the formatted text as I need
it.  This works well for SQL Server queries in DataSets.

The Binding object has a Format event where you can tell it how to
format your data by type.  Unfortunately it's not of much help for the
ComboBox list portion...

> Hi,
>
[quoted text clipped - 5 lines]
>
> David Adams
David Adams - 07 Jul 2004 22:17 GMT
Thank you all for your suggestions.

David

> You didn't state what the datasource was...but if you can override the
> ToString method on the datasource to return just the date part, that's
[quoted text clipped - 18 lines]
> >
> > David Adams

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.