練習用です。いろんなものがごちゃまぜです。
@@ -39,11 +39,12 @@ | ||
39 | 39 | Me.Button14 = New System.Windows.Forms.Button() |
40 | 40 | Me.TextBox1 = New System.Windows.Forms.TextBox() |
41 | 41 | Me.ListBox1 = New System.Windows.Forms.ListBox() |
42 | + Me.Label1 = New System.Windows.Forms.Label() | |
42 | 43 | Me.SuspendLayout() |
43 | 44 | ' |
44 | 45 | 'Button1 |
45 | 46 | ' |
46 | - Me.Button1.Location = New System.Drawing.Point(178, 164) | |
47 | + Me.Button1.Location = New System.Drawing.Point(178, 208) | |
47 | 48 | Me.Button1.Name = "Button1" |
48 | 49 | Me.Button1.Size = New System.Drawing.Size(75, 23) |
49 | 50 | Me.Button1.TabIndex = 0 |
@@ -52,7 +53,7 @@ | ||
52 | 53 | ' |
53 | 54 | 'Button2 |
54 | 55 | ' |
55 | - Me.Button2.Location = New System.Drawing.Point(259, 164) | |
56 | + Me.Button2.Location = New System.Drawing.Point(259, 208) | |
56 | 57 | Me.Button2.Name = "Button2" |
57 | 58 | Me.Button2.Size = New System.Drawing.Size(75, 23) |
58 | 59 | Me.Button2.TabIndex = 0 |
@@ -61,7 +62,7 @@ | ||
61 | 62 | ' |
62 | 63 | 'Button3 |
63 | 64 | ' |
64 | - Me.Button3.Location = New System.Drawing.Point(340, 164) | |
65 | + Me.Button3.Location = New System.Drawing.Point(340, 208) | |
65 | 66 | Me.Button3.Name = "Button3" |
66 | 67 | Me.Button3.Size = New System.Drawing.Size(75, 23) |
67 | 68 | Me.Button3.TabIndex = 0 |
@@ -70,7 +71,7 @@ | ||
70 | 71 | ' |
71 | 72 | 'Button4 |
72 | 73 | ' |
73 | - Me.Button4.Location = New System.Drawing.Point(178, 193) | |
74 | + Me.Button4.Location = New System.Drawing.Point(178, 237) | |
74 | 75 | Me.Button4.Name = "Button4" |
75 | 76 | Me.Button4.Size = New System.Drawing.Size(75, 23) |
76 | 77 | Me.Button4.TabIndex = 0 |
@@ -79,7 +80,7 @@ | ||
79 | 80 | ' |
80 | 81 | 'Button5 |
81 | 82 | ' |
82 | - Me.Button5.Location = New System.Drawing.Point(259, 193) | |
83 | + Me.Button5.Location = New System.Drawing.Point(259, 237) | |
83 | 84 | Me.Button5.Name = "Button5" |
84 | 85 | Me.Button5.Size = New System.Drawing.Size(75, 23) |
85 | 86 | Me.Button5.TabIndex = 0 |
@@ -88,7 +89,7 @@ | ||
88 | 89 | ' |
89 | 90 | 'Button6 |
90 | 91 | ' |
91 | - Me.Button6.Location = New System.Drawing.Point(340, 193) | |
92 | + Me.Button6.Location = New System.Drawing.Point(340, 237) | |
92 | 93 | Me.Button6.Name = "Button6" |
93 | 94 | Me.Button6.Size = New System.Drawing.Size(75, 23) |
94 | 95 | Me.Button6.TabIndex = 0 |
@@ -97,7 +98,7 @@ | ||
97 | 98 | ' |
98 | 99 | 'Button7 |
99 | 100 | ' |
100 | - Me.Button7.Location = New System.Drawing.Point(178, 222) | |
101 | + Me.Button7.Location = New System.Drawing.Point(178, 266) | |
101 | 102 | Me.Button7.Name = "Button7" |
102 | 103 | Me.Button7.Size = New System.Drawing.Size(75, 23) |
103 | 104 | Me.Button7.TabIndex = 0 |
@@ -106,7 +107,7 @@ | ||
106 | 107 | ' |
107 | 108 | 'Button8 |
108 | 109 | ' |
109 | - Me.Button8.Location = New System.Drawing.Point(259, 222) | |
110 | + Me.Button8.Location = New System.Drawing.Point(259, 266) | |
110 | 111 | Me.Button8.Name = "Button8" |
111 | 112 | Me.Button8.Size = New System.Drawing.Size(75, 23) |
112 | 113 | Me.Button8.TabIndex = 0 |
@@ -115,7 +116,7 @@ | ||
115 | 116 | ' |
116 | 117 | 'Button9 |
117 | 118 | ' |
118 | - Me.Button9.Location = New System.Drawing.Point(340, 222) | |
119 | + Me.Button9.Location = New System.Drawing.Point(340, 266) | |
119 | 120 | Me.Button9.Name = "Button9" |
120 | 121 | Me.Button9.Size = New System.Drawing.Size(75, 23) |
121 | 122 | Me.Button9.TabIndex = 0 |
@@ -124,7 +125,7 @@ | ||
124 | 125 | ' |
125 | 126 | 'Button0 |
126 | 127 | ' |
127 | - Me.Button0.Location = New System.Drawing.Point(259, 251) | |
128 | + Me.Button0.Location = New System.Drawing.Point(259, 295) | |
128 | 129 | Me.Button0.Name = "Button0" |
129 | 130 | Me.Button0.Size = New System.Drawing.Size(75, 23) |
130 | 131 | Me.Button0.TabIndex = 0 |
@@ -133,7 +134,7 @@ | ||
133 | 134 | ' |
134 | 135 | 'ButtonPlus |
135 | 136 | ' |
136 | - Me.ButtonPlus.Location = New System.Drawing.Point(421, 222) | |
137 | + Me.ButtonPlus.Location = New System.Drawing.Point(421, 266) | |
137 | 138 | Me.ButtonPlus.Name = "ButtonPlus" |
138 | 139 | Me.ButtonPlus.Size = New System.Drawing.Size(75, 23) |
139 | 140 | Me.ButtonPlus.TabIndex = 0 |
@@ -142,7 +143,7 @@ | ||
142 | 143 | ' |
143 | 144 | 'Button11 |
144 | 145 | ' |
145 | - Me.Button11.Location = New System.Drawing.Point(502, 222) | |
146 | + Me.Button11.Location = New System.Drawing.Point(502, 266) | |
146 | 147 | Me.Button11.Name = "Button11" |
147 | 148 | Me.Button11.Size = New System.Drawing.Size(75, 23) |
148 | 149 | Me.Button11.TabIndex = 0 |
@@ -151,7 +152,7 @@ | ||
151 | 152 | ' |
152 | 153 | 'Button12 |
153 | 154 | ' |
154 | - Me.Button12.Location = New System.Drawing.Point(502, 251) | |
155 | + Me.Button12.Location = New System.Drawing.Point(502, 295) | |
155 | 156 | Me.Button12.Name = "Button12" |
156 | 157 | Me.Button12.Size = New System.Drawing.Size(75, 23) |
157 | 158 | Me.Button12.TabIndex = 0 |
@@ -160,7 +161,7 @@ | ||
160 | 161 | ' |
161 | 162 | 'Button13 |
162 | 163 | ' |
163 | - Me.Button13.Location = New System.Drawing.Point(421, 251) | |
164 | + Me.Button13.Location = New System.Drawing.Point(421, 295) | |
164 | 165 | Me.Button13.Name = "Button13" |
165 | 166 | Me.Button13.Size = New System.Drawing.Size(75, 23) |
166 | 167 | Me.Button13.TabIndex = 0 |
@@ -169,7 +170,7 @@ | ||
169 | 170 | ' |
170 | 171 | 'Button14 |
171 | 172 | ' |
172 | - Me.Button14.Location = New System.Drawing.Point(502, 280) | |
173 | + Me.Button14.Location = New System.Drawing.Point(502, 324) | |
173 | 174 | Me.Button14.Name = "Button14" |
174 | 175 | Me.Button14.Size = New System.Drawing.Size(75, 23) |
175 | 176 | Me.Button14.TabIndex = 0 |
@@ -178,7 +179,7 @@ | ||
178 | 179 | ' |
179 | 180 | 'TextBox1 |
180 | 181 | ' |
181 | - Me.TextBox1.Location = New System.Drawing.Point(178, 117) | |
182 | + Me.TextBox1.Location = New System.Drawing.Point(178, 161) | |
182 | 183 | Me.TextBox1.Name = "TextBox1" |
183 | 184 | Me.TextBox1.Size = New System.Drawing.Size(318, 22) |
184 | 185 | Me.TextBox1.TabIndex = 1 |
@@ -192,11 +193,21 @@ | ||
192 | 193 | Me.ListBox1.Size = New System.Drawing.Size(318, 94) |
193 | 194 | Me.ListBox1.TabIndex = 2 |
194 | 195 | ' |
196 | + 'Label1 | |
197 | + ' | |
198 | + Me.Label1.AutoSize = True | |
199 | + Me.Label1.Location = New System.Drawing.Point(175, 126) | |
200 | + Me.Label1.Name = "Label1" | |
201 | + Me.Label1.Size = New System.Drawing.Size(48, 15) | |
202 | + Me.Label1.TabIndex = 3 | |
203 | + Me.Label1.Text = "Label1" | |
204 | + ' | |
195 | 205 | 'Form1 |
196 | 206 | ' |
197 | 207 | Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!) |
198 | 208 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font |
199 | 209 | Me.ClientSize = New System.Drawing.Size(800, 450) |
210 | + Me.Controls.Add(Me.Label1) | |
200 | 211 | Me.Controls.Add(Me.ListBox1) |
201 | 212 | Me.Controls.Add(Me.TextBox1) |
202 | 213 | Me.Controls.Add(Me.Button9) |
@@ -238,4 +249,5 @@ | ||
238 | 249 | Friend WithEvents Button14 As Button |
239 | 250 | Friend WithEvents TextBox1 As TextBox |
240 | 251 | Friend WithEvents ListBox1 As ListBox |
252 | + Friend WithEvents Label1 As Label | |
241 | 253 | End Class |
@@ -7,10 +7,12 @@ | ||
7 | 7 | Dim t = DirectCast(sender, Button).Text(0) |
8 | 8 | r.add(t) |
9 | 9 | TextBox1.Text = r.LastValue() |
10 | - ListBox1.Items(0) = r.Last | |
10 | + Label1.Text = r.Last | |
11 | + ListBox1.DataSource = Nothing | |
12 | + ListBox1.DataSource = r.history | |
11 | 13 | End Sub |
12 | 14 | |
13 | 15 | Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load |
14 | - ListBox1.Items.Add(s) | |
16 | + | |
15 | 17 | End Sub |
16 | 18 | End Class |
@@ -1,7 +1,7 @@ | ||
1 | 1 | Public Class calcModel |
2 | 2 | |
3 | 3 | |
4 | - Public history As List(Of String) | |
4 | + Public history As New List(Of String) | |
5 | 5 | |
6 | 6 | Public Last As String |
7 | 7 |
@@ -31,6 +31,7 @@ | ||
31 | 31 | |
32 | 32 | If c = "="c Then |
33 | 33 | isNew = True |
34 | + history.Add(Last + LastValue()) | |
34 | 35 | End If |
35 | 36 | |
36 | 37 | End Sub |