nczl.net
当前位置:首页 >> vB6.0计算器简单代码 >>

vB6.0计算器简单代码

Private Sub Command1_Click(Index As Integer) '0-9数字键 Text1.Text = Text1.Text & Index Text1.SetFocus End Sub Private Sub Command1_KeyPress(Index As Integer, KeyAscii As Integer) '阻止键盘输入,不过不知为什么没有用 KeyAscii = ...

这个不难啊~双击“加数”按钮,打开代码窗口,输入以下代码:Text3.Text=Val(Text1.Text)+Val(Text2.Text) 提示:Val是字符串转换成数值,如果你不加Val的话,就会变成字符串连接。

Dim num As String, num1 As String '存放两个操作数 Dim Op As String '存放运算符 Private Sub Command1_Click() '退格删除运算符最右边一个数 If num "" Then num = Left(num, Len(num) - 1) Disp.Caption = num End Sub Private Sub Command...

错误百出。 1、首先出错提示是因为除数b为0。为什么b等于0呢,因为b并不是全局变量,只是局部变量(跟text2_change事件中定义的b没有任何关系,同理a,c等都是局部变量),并且你没有赋值,做算术运算时默认是0。 2、所有的a,b,c都是局部变量,你...

这是我很久以前编的了 你看下吧 先声明:完全白痴的编程 Private Sub Command1_Click() If Label5 "" And Label5 = Text1 Then Text1 = "" Label1 = "": Label2 = "": Label3 = "": Label4 = "": Label5 = "" End If '上面作用是为了在运算完一...

http://bbs.bccn.net/thread-79952-1-1.html 自己看看,试试行不行,我没试过

Dim Num1, Num2 Dim S Private Sub Command2_Click() If InStr(1, Text1.Text, ".") = 0 Then Text1.Text = Text1.Text & "." End If sFocus End Sub Private Sub Command3_Click() Text1.Text = IIf(InStr(1, Text1.Text, ".") 0, Format(Num2,...

Private Sub Command1_Click() Label1.Caption = "+" c = a + b Text3.Text = Str(c) Command1.Enabled = False End Sub Private Sub Command2_Click() Label1.Caption = "-" c = a - b Text3.Text = Str(c) Command2.Enabled = False End Sub P...

Dim a As Double Dim b As Integer Private Sub Command1_Click() '清除按钮代码 Text1.Text = "" End Sub Private Sub Command10_Click() '1按钮代码 Text1.Text = Text1.Text + "1" End Sub Private Sub Command11_Click() Rem 0按钮代码 Text...

Private Sub Command1_Click() '“x2-8x+1=0”答案是4+根号15 与 4-根号15。 Dim A As Double A = Text1.Text Dim B As Double B = Text2.Text Dim C As Double C = Text3.Text Dim D As Double D = B ^ 2 - 4 * A * C If D < 0 Then MsgBox ("此...

网站首页 | 网站地图
All rights reserved Powered by www.nczl.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com