Home > Software engineering >  O master to help solve it
O master to help solve it

Time:10-04

I am a new VB, want to try to make up a text box calculator, which can help to see, brothers this code where the problem is, we should be grateful,
 Private Sub cmddsignchange_Click () 'add a plus or minus 
Dim data As an Integer
Data=https://bbs.csdn.net/topics/Val (Txtscreen. Text)
Length=Len (Txtscreen. Text)
If the data & gt; 0 Then
Txtscreen. Text=data * (1)
The Else
Txtscreen. Text=Right (Txtscreen. Text, length - 1)
End the If
End Sub

Private Sub cmdequ_Click () '="
Dim the result As a Double
Dim second As Double
Second=Val (Txtscreen. Text)
Sign=Index
The Select Case sign
Case 0
Result=first + second
Case 1
Result=first - second
Case 2
Result=first * second
Case 3
If the second=0 Then
MsgBox "divisor cannot be zero
"The Else
Result=first/second
End the If
End the Select
Txtscreen. Text=CStr (result)
End Sub

Private Sub cmdnumber_Click (Index As an Integer)
If Txtscreen. Text="0" Then
Txtscreen. Text=CStr (Index)
The Else
Txtscreen. Text=Txtscreen. Text & amp; CStr (Index)
End the If
End Sub

Private Sub Cmdon_Click ()
Txtscreen. Text="0"
End Sub

Private Sub cmdoperater_Click (Index As an Integer)
Dim first As a Double
First=Val (Txtscreen. Text)
Txtscreen. Text="0"
End Sub

Private Sub cmdpoint_Click ()
Txtscreen. Text=Txtscreen. Text & amp; ". "
End Sub

Private Sub Form_Load ()
For the Index=0 To 9
Cmdnumber (Index). Caption=cmdnumber (Index). The Index
Next the Index
End Sub

CodePudding user response:

http://download.csdn.net/download/stu_fly/4149067
http://download.csdn.net/detail/joeyu2009/1742268
http://download.csdn.net/detail/asd155655153/3421259
http://download.csdn.net/download/abcemituofo/833793
http://download.csdn.net/download/tony19810929/933182
  • Related