回答編集履歴
2
typo修正
test
CHANGED
@@ -14,9 +14,9 @@
|
|
14
14
|
|
15
15
|
```C#
|
16
16
|
|
17
|
-
private void Ctrl
|
17
|
+
private void Ctrl_Click(object sender, EventArgs e){
|
18
18
|
|
19
|
-
switch (sender as Control).Tag as string){
|
19
|
+
switch (sender as Control)?.Tag as string){
|
20
20
|
|
21
21
|
case "1":
|
22
22
|
|
1
回答に追記
test
CHANGED
@@ -9,3 +9,29 @@
|
|
9
9
|
私は、tagに通し番号を付けて、それでswitchさせるようにしてますね
|
10
10
|
|
11
11
|
同じ動作をさせる場合、同じtagをつけるってことができますね
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
```C#
|
16
|
+
|
17
|
+
private void CtrlOnClicked(object sender, EventArgs e){
|
18
|
+
|
19
|
+
switch (sender as Control).Tag as string){
|
20
|
+
|
21
|
+
case "1":
|
22
|
+
|
23
|
+
/*処理*/
|
24
|
+
|
25
|
+
break;
|
26
|
+
|
27
|
+
case "2":
|
28
|
+
|
29
|
+
/*処理*/
|
30
|
+
|
31
|
+
break;
|
32
|
+
|
33
|
+
}
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
```
|