求简单的VB编程代码 各位老大帮忙啊 10

邮箱328925237@qq.com一编制一个帐号与密码的检验程序:要求:①帐号不超过6个数字,密码4个字符(设密码为VB6),密码框中不显示实际输入字符②帐号(如:非数... 邮箱328925237@qq.com

编制一个帐号与密码的检验程序:
要求:① 帐号不超过6个数字,密码4个字符(设密码为VB6),
密码框中不显示实际输入字符
② 帐号(如:非数字)不正确时,提示有关信息,
并清除原内容,得到焦点,再输入
③ 密码不正确时,单击“重试”,密码框清空,得到焦
点重新输入,若单击“取消”,停止运行


在“种类”中选择油品种类,界面上的说明文字将随之改变,并将“数量”文本框设为焦点;在数量文本框中输入需购的油品数量后,单击“计算”按钮,在“总价”文本框显示所购油品种类应付的金额。已知汽油单价:
• 90号 2.30元/升
• 95号 2.45元/升
• 100号 2.60元/升


编写一个简单运算器的程序

• 要求:单击“计算”按钮,则根据输入操作数以及所选的运算符,求得运算结果,并显示在相应的文本框中。
• 提示:当除数为0时,用消息框给出提示


将一个二进制的原码转换成反码
分析:
循环语句—决定转换的次数
Mid函数--获取一个二进制位
If语句--判断该位0à1,1à0


字符加密。将由大写英文字母组成的字符串的每个字符的ASCII代码转换成二进制,按位与指定密钥“01111111”进行异或运算,把得到的结果转换成十进制数,再转换成对应的加密字符
分析:其中一个字符的转换
• 获取每个字母的ASCii码(ASC函数,取子串函数)
• 将十进制ASCII码转换成二进制ASCII码。
• 再与01111111进行异或运算
• 再转换成对应的字符(chr函数)
• 连接成字符串
展开
 我来答
bingxuan49
2009-12-12 · TA获得超过233个赞
知道小有建树答主
回答量:257
采纳率:0%
帮助的人:155万
展开全部
三、
Dim strmiddle() As String = {"0", "0", "0"}
Dim calmethod1 As String = "0"
Dim calmethod2 As String = "0"
Dim strdot As Boolean = False

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If strmiddle(0) = "0" Then
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "0"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "0"
TextBox1.Text = strmiddle(0)
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
strdot = True
strmiddle(0) = strmiddle(0) & "."
TextBox1.Text = strmiddle(0)
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
strmiddle(0) = "0"
strmiddle(1) = "0"
strmiddle(2) = "0"
calmethod1 = "0"
calmethod2 = "0"
strdot = False
TextBox1.Text = "0."
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If strmiddle(2) = "0" Then
Select Case calmethod1
Case "+"
TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
Case "-"
TextBox1.Text = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
Case "*"
TextBox1.Text = Str(Val(strmiddle(1)) * Val(strmiddle(0)))
Case "/"
If strmiddle(0) = "0" Then
TextBox1.Text = "error!"
Else
TextBox1.Text = Str(Val(strmiddle(1)) / Val(strmiddle(0)))
End If
End Select
ElseIf calmethod2 = "*" Then
strmiddle(0) = Str(Val(strmiddle(0)) * Val(strmiddle(2)))
Select Case calmethod1
Case "+"
TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
Case "-"
TextBox1.Text = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
Case "*"
TextBox1.Text = Str(Val(strmiddle(1)) * Val(strmiddle(0)))

Case "/"
If strmiddle(0) = "0" Then
TextBox1.Text = "error!"
Else
TextBox1.Text = Str(Val(strmiddle(1)) / Val(strmiddle(0)))
End If
End Select
Else : calmethod2 = "/"
strmiddle(0) = Str(Val(strmiddle(2)) / Val(strmiddle(0)))
Select Case calmethod1
Case "+"
TextBox1.Text = Str(Val(strmiddle(1)) + Val(strmiddle(0)))
Case "-"
TextBox1.Text = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
Case "*"
TextBox1.Text = Str(Val(strmiddle(1)) * Val(strmiddle(0)))
Case "/"
If strmiddle(0) = "0" Then
TextBox1.Text = "error!"
Else
TextBox1.Text = Str(Val(strmiddle(1)) / Val(strmiddle(0)))
End If
End Select
End If
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "1"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "1"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "1"
TextBox1.Text = strmiddle(0)
End If
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "2"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "2"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "2"
TextBox1.Text = strmiddle(0)
End If
End Sub

双击Button8数字键“3”按钮,进入该按钮的事件。
代码2-8:按钮的单击事件
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "3"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "3"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "3"
TextBox1.Text = strmiddle(0)
双击Button9计算键“+”按钮,进入该按钮的事件。
代码:2-9:按钮的单击事件
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If calmethod1 = "0" Then
calmethod1 = "+"
strmiddle(1) = strmiddle(0)
strmiddle(0) = "0"
Else : Select Case calmethod1
Case "+"
strmiddle(1) = Str(Val(strmiddle(0)) + Val(strmiddle(1)))
strmiddle(0) = "0"
calmethod1 = "+"
Case "-"
strmiddle(1) = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
strmiddle(0) = "0"
calmethod1 = "+"
Case "*"
strmiddle(1) = Str(Val(strmiddle(0)) * Val(strmiddle(1)))
strmiddle(0) = "0"
calmethod1 = "+"
Case "/"
strmiddle(1) = Str(Val(strmiddle(1)) / Val(strmiddle(0)))
strmiddle(0) = "0"
calmethod1 = "+"
End Select
End If
End Sub
双击Button10计算键“-”按钮,进入该按钮的事件,编写代码如2-10所示。
代码2-10:按钮的单击事件
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
If calmethod1 = "0" Then
calmethod1 = "-"
strmiddle(1) = strmiddle(0)
strmiddle(0) = "0"
Else : Select Case calmethod1
Case "+"
strmiddle(1) = Str(Val(strmiddle(0)) + Val(strmiddle(1)))
strmiddle(0) = "0"
calmethod1 = "-"
Case "-"
strmiddle(1) = Str(Val(strmiddle(1)) - Val(strmiddle(0)))
strmiddle(0) = "0"
calmethod1 = "-"
Case "*"
strmiddle(1) = Str(Val(strmiddle(0)) * Val(strmiddle(1)))
strmiddle(0) = "0"
calmethod1 = "-"
Case "/"
strmiddle(1) = Str(Val(strmiddle(1)) / Val(strmiddle(0)))
strmiddle(0) = "0"
calmethod1 = "-"
End Select
End If
End Sub
双击Button11数字键“4”按钮,进入该按钮的事件。
代码2-11:按钮的单击事件
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "4"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "4"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "4"
TextBox1.Text = strmiddle(0)
End If
End Sub
双击Button12数字键“5”按钮,进入该按钮的事件。
代码2-12:按钮的单击事件
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "5"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "5"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "5"
TextBox1.Text = strmiddle(0)
End If
End Sub
双击Button12数字键“5”按钮,进入该按钮的事件。
代码2-12:按钮的单击事件
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
If strmiddle(0) = "0" Then
strmiddle(0) = "5"
TextBox1.Text = strmiddle(0) & "."
ElseIf strdot = False Then
strmiddle(0) = strmiddle(0) & "5"
TextBox1.Text = strmiddle(0) & "."
Else
strmiddle(0) = strmiddle(0) & "5"
TextBox1.Text = strmiddle(0)
End If
End Sub

End If
End Sub
。。。。。。。
以此做下去,就好了。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式