1

私はこの奇妙な問題を抱えています。会計プリンターでデータを印刷する必要があります(すべての参照は問題ありません)。

ウィンドウに 1 つのボタンを配置し、Click イベントにそのコードを配置すると、次のようになります。

        printer eso = new printer;
        string resultString = Regex.Match(port, @"\d+").Value;
        int a = eso._CommunicationInit(int.Parse(resultString), 9600, 5);
        eso._NonFiscalPrintoutBegin(20); 
        eso._pNonFiscalPrintoutLine(20, personNameSurname, 1); 
        // eso._pNonFiscalPrintoutLine(30,Description, 20); 
        eso._pNonFiscalPrintoutLine(40, Math.Round(price, 2, MidpointRounding.AwayFromZero).ToString(), 1);
        eso._pNonFiscalPrintoutLine(50, "", 1); 
        eso._pNonFiscalPrintoutLine(70, "", 1); 
        eso._NonFiscalPrintoutEnd();
        eso._CommunicationEnd();

しかし、次のようなクラス内で同じコードを使用する場合:

button.click -> myClass.print(parameters)、エラーが発生しています

タイプ 'System.StackOverflowException' の未処理の例外が WindowsBase.dll で発生しました

これに対する解決策はありますか?

前もって感謝します!

4

0 に答える 0