Click here to Skip to main content
15,915,742 members
Home / Discussions / C#
   

C#

 
QuestionDate Formatting Pin
Brendan Vogt24-Jul-06 2:50
Brendan Vogt24-Jul-06 2:50 
AnswerRe: Date Formatting Pin
stancrm24-Jul-06 2:55
stancrm24-Jul-06 2:55 
GeneralRe: Date Formatting Pin
Brendan Vogt24-Jul-06 3:08
Brendan Vogt24-Jul-06 3:08 
GeneralRe: Date Formatting Pin
stancrm24-Jul-06 3:12
stancrm24-Jul-06 3:12 
GeneralRe: Date Formatting Pin
Brendan Vogt24-Jul-06 3:14
Brendan Vogt24-Jul-06 3:14 
GeneralRe: Date Formatting Pin
stancrm24-Jul-06 3:15
stancrm24-Jul-06 3:15 
GeneralRe: Date Formatting Pin
Brendan Vogt24-Jul-06 3:20
Brendan Vogt24-Jul-06 3:20 
GeneralRe: Date Formatting Pin
Brendan Vogt24-Jul-06 21:36
Brendan Vogt24-Jul-06 21:36 
Hi,

Sorry to bother again. I have a similar situation where I have a drop down, and the value of each item is the ID. How do I format this like D2 and put it into a string?

I used this and it didn't want to work, please advise what I am doing wrong:

string strOrderType = cboOrderTypes.SelectedItem.Value.ToString("D2");

It underlines cboOrderTypes in red saying:
The best overloaded method match for 'string.ToString(System.IFormatProvider)' has some invalid arguments

And it underlines "D2" in red saying:
Argument '1': cannot convert from 'string' to 'System.IFormatProvider'

So I did it like this which seems to work, but isn't there a shorter way than doing first a conversion to int, and then back to string again?

string strOrderType = Int32.Parse(cboOrderTypes.SelectedItem.Value).ToString("D2");

Please help.

Regards,
ma se
GeneralRe: Date Formatting Pin
stancrm24-Jul-06 22:26
stancrm24-Jul-06 22:26 
GeneralRe: Date Formatting Pin
Brendan Vogt24-Jul-06 22:28
Brendan Vogt24-Jul-06 22:28 
Questionradiobutton Pin
Mamphekgo24-Jul-06 2:49
Mamphekgo24-Jul-06 2:49 
AnswerRe: radiobutton Pin
stancrm24-Jul-06 2:59
stancrm24-Jul-06 2:59 
Questiona little help in creating a chess game Pin
ThetaClear24-Jul-06 2:18
ThetaClear24-Jul-06 2:18 
AnswerRe: a little help in creating a chess game Pin
rah_sin24-Jul-06 2:32
professionalrah_sin24-Jul-06 2:32 
GeneralRe: a little help in creating a chess game Pin
ThetaClear24-Jul-06 3:12
ThetaClear24-Jul-06 3:12 
GeneralRe: a little help in creating a chess game Pin
Robert Rohde24-Jul-06 3:21
Robert Rohde24-Jul-06 3:21 
GeneralRe: a little help in creating a chess game Pin
ThetaClear24-Jul-06 3:36
ThetaClear24-Jul-06 3:36 
GeneralRe: a little help in creating a chess game Pin
stancrm24-Jul-06 3:45
stancrm24-Jul-06 3:45 
GeneralRe: a little help in creating a chess game Pin
ThetaClear24-Jul-06 5:14
ThetaClear24-Jul-06 5:14 
Questionproblem in event execution Pin
nicolus24-Jul-06 2:17
nicolus24-Jul-06 2:17 
AnswerRe: problem in event execution Pin
LongRange.Shooter24-Jul-06 6:10
LongRange.Shooter24-Jul-06 6:10 
Questioncreating a setup project ? help please ... Pin
cmpeng3424-Jul-06 1:49
cmpeng3424-Jul-06 1:49 
AnswerRe: creating a setup project ? help please ... Pin
Rizwan Bashir24-Jul-06 3:54
Rizwan Bashir24-Jul-06 3:54 
GeneralC# Source code for textbox validation Pin
rasmikant24-Jul-06 1:35
rasmikant24-Jul-06 1:35 
GeneralRe: C# Source code for textbox validation Pin
Ed.Poore24-Jul-06 1:38
Ed.Poore24-Jul-06 1:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.