Winformコンソールに文字列を出力するには?

Windows フォームでは、次のメソッドを使用して制御コンソールにテキストを出力できます。

  1. Console.WriteLine()
Console.WriteLine("Hello, World!");
  1. Console.WriteLine()
Console.Write("Hello, ");
Console.Write("World!");
  1. Console.SetOut()
  2. ストリームライター
StreamWriter writer = new StreamWriter("output.txt");
Console.SetOut(writer);
Console.WriteLine("Hello, World!");

コンソールアプリケーションでのみコンソール出力が使用できることに注意してください。WinFormsアプリケーションでは使用できません。WinFormsアプリケーションでは、LabelやTextBoxなどの他のUI要素を使用してテキストコンテンツを表示できます。

bannerAds