質問編集履歴
3
詳しく修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,26 +5,41 @@
|
|
5
5
|
|
6
6
|
public partial class Form1 : Form
|
7
7
|
{
|
8
|
-
public float a
|
8
|
+
public float a ; // textboxの値を取ってきます
|
9
|
-
public float b
|
9
|
+
public float b ; // textboxの値を取ってきます
|
10
10
|
|
11
|
+
public void keisan()
|
12
|
+
{
|
13
|
+
Test.test(a,b)
|
14
|
+
}
|
15
|
+
|
11
16
|
public void save_bt_Click(object sender, EventArgs e)
|
12
17
|
{
|
13
|
-
Save.save (
|
18
|
+
Save.save ( x ); // クラス「Test」内の変数、x を受け取り、引数で渡したい
|
14
19
|
}
|
15
20
|
}
|
16
21
|
|
17
22
|
public partial class Test
|
18
23
|
{
|
19
|
-
public float x
|
24
|
+
public float x;
|
25
|
+
|
26
|
+
public static void test ( float a, float b )
|
27
|
+
{
|
28
|
+
Test t = new Test();
|
29
|
+
t.x = a + b;
|
30
|
+
}
|
20
31
|
}
|
21
32
|
|
22
33
|
public class Save
|
23
34
|
{
|
24
|
-
public static void
|
35
|
+
public static void save( float x)
|
25
36
|
{
|
37
|
+
StreamWriter sw = new System.IO.StreamWriter(
|
38
|
+
@"C:\data\file",
|
39
|
+
true,
|
40
|
+
System.Text.Encoding.GetEncoding("shift_jis")
|
26
|
-
|
41
|
+
);
|
42
|
+
|
27
|
-
|
43
|
+
sw.WriteLine(String.Format("C {0}", x);
|
28
|
-
・
|
29
44
|
}
|
30
45
|
}
|
2
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,16 +17,7 @@
|
|
17
17
|
public partial class Test
|
18
18
|
{
|
19
19
|
public float x = 30;
|
20
|
-
・
|
21
|
-
・
|
22
|
-
・
|
23
|
-
public static void sample1
|
24
|
-
{
|
25
|
-
・
|
26
|
-
・
|
27
|
-
・
|
28
|
-
|
20
|
+
}
|
29
|
-
}
|
30
21
|
|
31
22
|
public class Save
|
32
23
|
{
|
1
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
public float a = 10;
|
9
9
|
public float b = 20;
|
10
10
|
|
11
|
-
|
11
|
+
public void save_bt_Click(object sender, EventArgs e)
|
12
12
|
{
|
13
13
|
Save.save ( a , b , x ); // クラス「Test」内の変数、x を受け取り、引数で渡したい
|
14
14
|
}
|