Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 12th, 2003, 08:19 AM
Registered User
 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default date display memeber in combobox

Hi there,

My combobox datasource is a table from the database. The display member for the combobox is a date field. At database level this field is in short date format. However, when display in the combobox this field is displayed in long date format. How can I get the date displayed in the correct short date format in the combobox?

When I check the XML result of the select query by running the Webservice, the time is added as 00:00:00.0000 but in the combobox the time is 12:00:00 AM.

Also, if I bound the same dataset to a datagrid, this field is displayed correctly in short date fomat.

Please help.

Many thanks in advance

tw

 
Old July 13th, 2003, 02:10 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

You can use dropdown's DataTextFormatString property in order to format the value from data source. For display the datetime value as short date u can use:
Code:
dropDown1.DataTextFormatString="{0:d}";
...but the Soon is eclipsed by the Moon
 
Old July 13th, 2003, 10:14 AM
Registered User
 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, I forgot to say that I am developing window application client.

tw
Quote:
quote:Originally posted by NotNowJohn
 You can use dropdown's DataTextFormatString property in order to format the value from data source. For display the datetime value as short date u can use:
Code:
dropDown1.DataTextFormatString="{0:d}";
...but the Soon is eclipsed by the Moon





Similar Threads
Thread Thread Starter Forum Replies Last Post
display Records in ComboBox therese C# 2005 4 July 26th, 2008 05:28 AM
how to display 2 fields as a choice in 1 combobox dilipv General .NET 0 March 5th, 2008 07:21 AM
How get the date from Combobox abeen C# 1 July 22nd, 2006 03:38 AM
LogOnInfo not a memeber of ceema Crystal Reports 1 June 6th, 2006 02:23 AM
Display 2 fields as one line in the combobox osemollie VB Databases Basics 2 May 17th, 2006 10:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.