输入字符串的格式不正确

本文关键字:不正确 格式 字符串 输入 | 更新日期: 2023-09-27 18:32:19

我收到错误消息

输入字符串的格式不正确。

 public partial class Fiche_Ordre : DevExpress.XtraEditors.XtraForm
    {
        public string ClientID = "", OderId = "", TempId = "";
       .....
        public Fiche_Ordre()
        {
            InitializeComponent();
            Constuct_Page();
        }
        public Fiche_Ordre(string OrderID)
        {
            InitializeComponent();
            Constuct_Page();
            Pers_Ordre oPersOrdr = oOrder_BL.Get_OrdreOne_BL(ClientID, Convert.ToInt32(OderId), false);
            textEdit_RaisonSoc.Text = oPersOrdr.RaisonSoc;
        }

当我从其他形式调用构造器时:

 private void GoToFiche(object sender, EventArgs e)
        {
            try
            {                              
                Fiche_Ordre f_Fiche = new Fiche_Ordre("1");
               // Fiche_Ordre f_Fiche = new Fiche_Ordre(gridView_Liste_Ordres.GetRowCellValue(0, "NO_ORDRE").ToString());
                f_Fiche.Show();
            }
            catch (Exception excThrown)
            {
                MessageBox.Show(excThrown.Message);          
            }

我有构造函数:public Fiche_Ordre(string OrderID)

输入字符串的格式不正确

 public Fiche_Ordre(string OrderID)
        {
            InitializeComponent();
            Constuct_Page();
            Pers_Ordre oPersOrdr = oOrder_BL.Get_OrdreOne_BL(ClientID, Convert.ToInt32(OderId), false);
            textEdit_RaisonSoc.Text = oPersOrdr.RaisonSoc;
        }

您正在传递OrderID并使用OderId.

注意您的大小写和拼写。