vb错误13

来源:百度知道 编辑:UC知道 时间:2024/05/05 20:25:39
Private Sub Command1_Click()
a = Text1.Text: b = Text2.Text: c = Text3.Text: d = Text4.Text: e = Text5.Text: f = Text6.Text: g = Text7.Text: h = Text8.Text: i = Text9.Text

a = (0 + d + b + d) / 4: b = (a + c + 50 + c) / 4: c = (d + f + 50 + b): d = (0 + e + c + a) / 4: e = (0 + h + f + d) / 4: f = (e + g + 50 + c) / 4: g = (h + h + 50 + f) / 4: h = (0 + i + g + e) / 4: i = (0 + 0 + h + h) / 4
Text1.Text = a: Text2.Text = b: Text3.Text = c: Text4.Text = d: Text5.Text = e: Text6.Text = f: Text7.Text = g: Text8.Text = h: Text9.Text = i

End Sub

Private Sub Form_Load()
Label1.Visible = True
Label2.Visible = False
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim e As Integer

Dim f As Integer
Dim g As Integer
Dim h As Integer
Dim i As Integer
End Sub

第一次点command还行第二次就不行了

这样改,你的声明位置不对,类型也欠妥。
==========
Dim a As Single
Dim b As Single
Dim c As Single
Dim d As Single
Dim e As Single

Dim f As Single
Dim g As Single
Dim h As Single
Dim i As Single
Private Sub Command1_Click()
a = Text1.Text: b = Text2.Text: c = Text3.Text: d = Text4.Text: e = Text5.Text: f = Text6.Text: g = Text7.Text: h = Text8.Text: i = Text9.Text

a = (0 + d + b + d) / 4: b = (a + c + 50 + c) / 4: c = (d + f + 50 + b): d = (0 + e + c + a) / 4: e = (0 + h + f + d) / 4: f = (e + g + 50 + c) / 4: g = (h + h + 50 + f) / 4: h = (0 + i + g + e) / 4: i = (0 + 0 + h + h) / 4
Text1.Text = a: Text2.Text = b: Text3.Text = c: Text4.Text = d: Text5.Text = e: Text6.Text = f: Text7.Text = g: Text8.Text = h: Text9.Text = i

End Sub