01.
using
System;
02.
using
System.Windows.Forms;
03.
04.
namespace
DataGridView
05.
{
06.
public
partial
class
Form1 : Form
07.
{
08.
public
Form1()
09.
{
10.
InitializeComponent();
11.
}
12.
13.
private
void
button1_Click(
object
sender, EventArgs e)
14.
{
15.
string
message = textBox1.Text;
16.
17.
MessageBox.Show(message);
18.
}
19.
20.
private
void
button2_Click(
object
sender, EventArgs e)
21.
{
22.
string
message =
"こんにちは"
;
23.
24.
Console.WriteLine(message);
25.
}
26.
}
27.
}
06) public partial class Form1 : Form partial は、Form1 の定義が別にもある事を示す。 ※ Form1.Designer.cs がその片割れで、システムが画面定義を行っている Form1 : Form は Form クラスを継承した Form1 クラスである事を示す 08) public Form1() クラス名と同盟の public なメソッドはコンストラクタです。 InitializeComponent は、Form1.Designer.cs に定義されています ▼ タブの設定![]()