vb中 Dim a As Double, b As Double, sn As Double, tn As Double picturel.Cls 这一行不能编译 为啥呢?
程序是这样的PrivateSubCommand1_Click()DimiAsIntegerDimaAsDouble,bAsDouble,snAsDouble,tnAsDo...
程序是这样的
Private Sub Command1_Click()
Dim i As Integer
Dim a As Double, b As Double, sn As Double, tn As Double
picturel.Cls
i = 1: tn = 0: sn = 0
a = Val(Text1.Text)
b = a
If Val(Text1.Text) > 0 And Val(Text1.Text) < 10 And Val(Text2.Text) > 2 Then
Do While (i <= CInt(Text2.Text))
tn = tn + a
sn = sn + tn
tn = tn * 10
i = i + 1
Loop
Else
MsgBox "请输入10以内的自然数!", vbOKOnly + vbInformation, "数据错误"
End If
Picture1.Print b & "+" & b & b & "+..." & "+"; tn & "="; sn
请高手们帮忙 找一下程序中的错误 的地方不胜感激 展开
Private Sub Command1_Click()
Dim i As Integer
Dim a As Double, b As Double, sn As Double, tn As Double
picturel.Cls
i = 1: tn = 0: sn = 0
a = Val(Text1.Text)
b = a
If Val(Text1.Text) > 0 And Val(Text1.Text) < 10 And Val(Text2.Text) > 2 Then
Do While (i <= CInt(Text2.Text))
tn = tn + a
sn = sn + tn
tn = tn * 10
i = i + 1
Loop
Else
MsgBox "请输入10以内的自然数!", vbOKOnly + vbInformation, "数据错误"
End If
Picture1.Print b & "+" & b & b & "+..." & "+"; tn & "="; sn
请高手们帮忙 找一下程序中的错误 的地方不胜感激 展开
3个回答
展开全部
picture1.Cls 是对的,但是不要不“1”写成“l ”
if的判断条件中,要先将Val(Text1.Text) 赋值给一个变量,比如在前面加的一行代码:
a = Val(Text1.Text)
x=Val(Text2.Text)
y= CInt(Text2.Text)
那么,if过程可以写成:
If a> 0 And a< 10 And x> 2 Then
Do While (i <= y)
tn = tn + a
sn = sn + tn
tn = tn * 10
i = i + 1
Loop
if的判断条件中,要先将Val(Text1.Text) 赋值给一个变量,比如在前面加的一行代码:
a = Val(Text1.Text)
x=Val(Text2.Text)
y= CInt(Text2.Text)
那么,if过程可以写成:
If a> 0 And a< 10 And x> 2 Then
Do While (i <= y)
tn = tn + a
sn = sn + tn
tn = tn * 10
i = i + 1
Loop
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
picturel.Cls 应是 Picture1.Cls 吧。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询