繁体   English   中英

空引用异常未处理C#

[英]null reference exception was unhandled C#

private void StartReadInlay2()
    {
        byte[] cSN = new byte[8];           
        byte[] sw12 = new byte[2];
        string strsw12 = "", errdes = "", result = "";

        test1_2 = new Initialisation();

        test1_2.logmode = Convert.ToInt32(ConfigurationSettings.AppSettings["LogMode"]);
        test1_2.iChipType = GetChipType(lblChipType.Text.Trim());

        //--initialise test
        result = test1_2.Initialise(1, **configXML.fnSamSlot**, configXML, ref cSN, ref sProgress1_2, ref lProcess1_2, ref sw12, ref errdes);
        scSN1_2 = Hex.ToHexString(test1_2.chipID);
        strsw12 = Hex.ToHexString(sw12);

        if (strsw12.Equals("0000"))
            errInlay1_2 = result.ToString();
        else
            errInlay1_2 = result.ToString() + strsw12;

        lProcess1_2 = 2;

        if(!errInlay1_2.Equals(""))
            StatusInlay1_2 = false;
        else
            StatusInlay1_2 = true;
    }

对于初学者来说很好,您的整个代码示例都在C#中进行,如果您尝试编写VB.NET应用程序,肯定会崩溃。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM