vb编程:高手,帮帮~~谢谢~

来源:百度知道 编辑:UC知道 时间:2024/07/06 01:18:49
1,设有x、y、z三个数值变量,将数值最大的变量存储到变量max,第二大的变量存储mid,最小的变量存到min。

2、设有一密码输入窗体frmpassword,用户在该窗体的文本框txtpassword中输入密码,按确定键cmd0k后,如输入等于abcd,调用主窗体frmmail,否则清空文本待重新输入,若三次输入错误,则结束程序。请写出事件过程private sub cmd0k-click()到end sub中的一段代码。

本人非本专业,考试急用,可能题很菜~劳烦高手~准确详细答疑~
谢谢!

以下代码可以解决你的问题,不信你可以在VB里运行一下;
第一题:
Dim Max As Integer
Dim Mid As Integer
Dim min As Integer
Dim x As Integer, y As Integer, z As Integer
If x > y And x > z Then
Max = x
ElseIf y > z Then
Max = y
Else
Max = z
End If

If x > y And x < z Then
Mid = x
ElseIf y < z Then
Mid = z
Else
Mid = y
End If

If x < y And x < z Then
min = x
ElseIf y < z Then
min = y
Else
min = z
End If

第二题:
Static m As Integer
If txtpassword.Text = "abcd" Then
frmmail.Show
Unload Me
Else
If m < 2 Then
txtpassword.Text = ""
txtpassword.SetFocus
ElseIf m >= 2 Then
End
m = m + 1
End If
m = m + 1
End If

分那么少,事情不少.
有空给你坚决.

dim x,y,z ,max,min,mid as integer
x=inputbox("输入X")
y=i