ボタンが押されるたびに、ファイルに 1 行のテキストを書き込んでいます。
次のような静的クラスを定義しました。
public static class PalletRecord
{
public static string MachineName { get; set; }
public static DateTime TimeStamp { get; set; }
public static string BranchPlant { get; set; }
public static string Location { get; set; }
public static string Data { get; set; }
public static string ItemCode { get; set; }
public static string ItemDescription { get; set; }
public static decimal Quantity { get; set; }
}
ファイルに書き込む必要があるたびに、静的クラス プロパティを設定し、File.AppendAllLines を使用してテキスト ファイルに書き込みます。
非静的クラスでそれを行う必要がありましたか?