减去转换为int的字符串然后返回字符串:

时间:2018-07-28 06:57:17

标签: c# asp.net time

这是我的代码。我不知道为什么它不起作用。它告诉我写下更多。

int todayINTyear = 0;
    int birthINTyear = 0;
    int antINTyear = 0;

    DOB_whole.Value = DayDOB_DDL.SelectedItem.ToString() + "/" + MonthDOB_DLL.SelectedItem.ToString() + "/" + YearDOB_DDL.SelectedItem.ToString();
    todayYear_Value.Value = DateTime.Now.Year.ToString();
    todayINTyear = Int32.Parse(yearValue.Value.ToString());
    birthINTyear = Int32.Parse(YearDOB_DDL.SelectedItem.ToString());
    antINTyear = Int32.Parse(AGE.Value.ToString());

    antINTyear = birthINTyear - todayINTyear;

    string AGE_Value = antINTyear.ToString();

    AGE_Displayed.Value = AGE_Value;

    AGELabel.Text = AGE_Displayed.Value.ToString();

行不对:

  

todayINTyear = Int32.Parse(yearValue.Value.ToString());

堆栈跟踪

  

[FormatException:输入字符串的格式不正确。]      System.Number.StringToNumber(字符串str,NumberStyles选项,NumberBuffer&数字,NumberFormatInfo信息,布尔值parseDecimal)+14502124      System.Number.ParseInt32(字符串s,NumberStyles样式,NumberFormatInfo信息)+172      C:\ inetpub \ wwwroot \ motorcity3d.com \ www \ Registration.aspx.cs:145中的Registration.Page_Load(Object sender,EventArgs e)      System.Web.UI.Control.OnLoad(EventArgs e)+106      System.Web.UI.Control.LoadRecursive()+68      System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+3785

0 个答案:

没有答案