質問編集履歴
1
ソースを追加しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,7 +20,55 @@
|
|
20
20
|
|
21
21
|
```lang-<VB.net>
|
22
22
|
|
23
|
+
Public Class Form2
|
24
|
+
|
25
|
+
Dim Fname As String
|
26
|
+
|
27
|
+
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
28
|
+
|
29
|
+
Dim path As String = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal) 'マイドキュメントのパス
|
30
|
+
|
31
|
+
Dim sr As New System.IO.StreamReader(path + "\MyConStudio\AppDate\text.txt", _
|
32
|
+
|
33
|
+
System.Text.Encoding.GetEncoding("shift_jis"))
|
34
|
+
|
35
|
+
'内容をすべて読み込む
|
36
|
+
|
37
|
+
Fname = sr.ReadToEnd()
|
38
|
+
|
39
|
+
'閉じる
|
40
|
+
|
41
|
+
sr.Close()
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
Dim FL As New System.IO.StreamReader(Fname, _
|
46
|
+
|
47
|
+
System.Text.Encoding.GetEncoding("shift_jis"))
|
48
|
+
|
49
|
+
'内容をすべて読み込む
|
50
|
+
|
51
|
+
AzukiControl1.Text = FL.ReadToEnd()
|
52
|
+
|
53
|
+
'閉じる
|
54
|
+
|
55
|
+
FL.Close()
|
56
|
+
|
57
|
+
Me.Text = Fname
|
58
|
+
|
59
|
+
End Sub
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
64
|
+
|
65
|
+
Me.Save()
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
End Sub
|
70
|
+
|
23
|
-
Public Sub Save()
|
71
|
+
Public Sub Save()
|
24
72
|
|
25
73
|
Dim sw As New System.IO.StreamWriter(Fname, _
|
26
74
|
|
@@ -30,13 +78,15 @@
|
|
30
78
|
|
31
79
|
'TextBox1.Textの内容を書き込む
|
32
80
|
|
33
|
-
sw.Write(AzukiControl1.Text)
|
81
|
+
sw.Write(Me.AzukiControl1.Text)
|
34
82
|
|
35
83
|
'閉じる
|
36
84
|
|
37
85
|
sw.Close()
|
38
86
|
|
39
87
|
End Sub
|
88
|
+
|
89
|
+
End Class
|
40
90
|
|
41
91
|
```
|
42
92
|
|
@@ -47,3 +97,67 @@
|
|
47
97
|
Form2.Save()
|
48
98
|
|
49
99
|
```
|
100
|
+
|
101
|
+
MDI子フォームの呼び出し
|
102
|
+
|
103
|
+
```lang-<VB.net>
|
104
|
+
|
105
|
+
'main.mcs表示
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
Dim sw As New System.IO.StreamWriter(path + "\MyConStudio\AppDate\text.txt", _
|
110
|
+
|
111
|
+
False, _
|
112
|
+
|
113
|
+
System.Text.Encoding.GetEncoding("shift_jis"))
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
sw.Write(Pname + "main.mcs")
|
118
|
+
|
119
|
+
'閉じる
|
120
|
+
|
121
|
+
sw.Close()
|
122
|
+
|
123
|
+
Dim NewMDIChild As New Form2()
|
124
|
+
|
125
|
+
'Set the Parent Form of the Child window.
|
126
|
+
|
127
|
+
NewMDIChild.MdiParent = Me
|
128
|
+
|
129
|
+
'Display the new form.
|
130
|
+
|
131
|
+
NewMDIChild.Show()
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
'AboutProject.txt表示
|
138
|
+
|
139
|
+
Dim sw1 As New System.IO.StreamWriter(path + "\MyConStudio\AppDate\text.txt", _
|
140
|
+
|
141
|
+
False, _
|
142
|
+
|
143
|
+
System.Text.Encoding.GetEncoding("shift_jis"))
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
sw1.Write(Pname + "AboutProject.txt")
|
148
|
+
|
149
|
+
'閉じる
|
150
|
+
|
151
|
+
sw1.Close()
|
152
|
+
|
153
|
+
Dim NewMDIChild2 As New Form2()
|
154
|
+
|
155
|
+
'Set the Parent Form of the Child window.
|
156
|
+
|
157
|
+
NewMDIChild2.MdiParent = Me
|
158
|
+
|
159
|
+
'Display the new form.
|
160
|
+
|
161
|
+
NewMDIChild2.Show()
|
162
|
+
|
163
|
+
```
|