赵弈钦:我想问个有关编程的问题。。。

来源:百度文库 编辑:高考问答 时间:2024/04/30 13:48:13
我弄了7个文本框(text)
我想让其中5个文本框内的数(text1-5)除以最后一个文本框(text6)
然后如果除完以后的余数得5
那么文本框7内写可以除的开
如果不得5
那么文本框7内就写除不开
其中text8.text是我算余数的地方。。
下面是我的代码…………

If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Then
MsgBox "一个都不能少!", 16, "123"
Exit Sub
End If
Text8.Text = Val(Text2.Text + Text3.Text + Text4.Text + Text5.Text + Text6.Text) / Val(Text1.Text)
If Text8.Text Mod 5 Then
text7.text = "除的开"
Else
text7.text = "除不开"
Exit Sub
End If

Text8中不是存余数吗? Text1为什么不加进去呢?
Text8.Text = Val(Text2.Text + Text3.Text + Text4.Text + Text5.Text + Text6.Text) / Val(Text1.Text)
改成
Text8.Text = Val(Text1.Text+Text2.Text + Text3.Text + Text4.Text + Text5.Text + Text6.Text) mod Val(Text1.Text)