Input string was not in a correct format

后端 未结 8 1301
滥情空心
滥情空心 2020-11-22 02:55

I\'m new with C#, I have some basic knowledge in Java but I can\'t get this code to run properly.

It\'s just a basic calculator, but when I run the program VS2008 gi

8条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 03:25

    it was my problem too .. in my case i changed the PERSIAN number to LATIN number and it worked. AND also trime your string before converting.

    PersianCalendar pc = new PersianCalendar();
    char[] seperator ={'/'};
    string[] date = txtSaleDate.Text.Split(seperator);
    int a = Convert.ToInt32(Persia.Number.ConvertToLatin(date[0]).Trim());
    

提交回复
热议问题