1

如何解决以下行中发生的输入字符串错误:

 string body = String.Format(
     "The following leave request was made by user {o}: \n Date: {1} \t Hours: {2} \t Reason: {3}", 
     username.ToString(), 
     TxtBoxDate.Text,
     DDHours.SelectedValue+DDTimeWindow.SelectedValue, 
     TxtNotes.Text);
4

4 回答 4

16

看起来你有字母o而不是零0。尝试:

string body = String.Format("The following leave request was made by user {0}: \n Date: {1} \t Hours: {2} \t Reason: {3}", username.ToString(), TxtBoxDate.Text, DDHours.SelectedValue+DDTimeWindow.SelectedValue, TxtNotes.Text);
于 2013-07-26T12:42:29.020 回答
2

简单的错字,您使用o的是0

于 2013-07-26T12:43:12.390 回答
2

只需将“o”更改为“0”(零)。

于 2013-07-26T12:43:30.497 回答
2

你有一个 O 而不是一个零{o}->{0}

    string body =
        String.Format(
            "The following leave request was made by user {0}: \n Date: {1} \t Hours: {2} \t Reason: {3}",
            username.ToString(), 
            TxtBoxDate.Text, 
            DDHours.SelectedValue + DDTimeWindow.SelectedValue,
            TxtNotes.Text);
于 2013-07-26T12:43:32.180 回答