vb程序设计题目

来源:百度知道 编辑:UC知道 时间:2024/06/22 09:47:54
求VB
1.设计一程序使在文本框(text1)中输入字符时,只能输入数字,输入错误三次将终止程序.
2.请编写一程序,能对一数值数组按降序的方式排列.
谢谢 人在等到13:30
具体情况我不清楚 这个是鸟老师给的题目 重修擦

错误三次将终止程序这个不必要吧
1
Private Sub Text1_KeyPress(KeyAscii As Integer)
Static n As Single

If KeyAscii = 8 Then Exit Sub '退格键,不处理
If KeyAscii > 57 Or KeyAscii < 48 Then
KeyAscii = 0
n = n + 1
End If
If n > 3 Then '没什么必要哦
MsgBox "数错3次了,将退出系统"
End
End If
End Sub

2
dim suzu(10) as single
for i=0 to 9
for j=i+1 to 10
if suzu(i)>suzu(j) then
tem=suzu(i)
suzu(i)=suzu(j)
suzu(j)=tem
endif
next
next

要是等不到捏?