Option Explicit
Dim temp As Integer


Private Sub Form_Load()
   Text1.Enabled = False
   Text1.MaxLength = 10
   End Sub

Private Sub Command1_Click()
Text1.Text = Text1.Text + "1"
End Sub
Private Sub Command2_Click()
Text1.Text = Text1.Text + "2"
End Sub
Private Sub Command3_Click()
Text1.Text = Text1.Text + "3"
End Sub
Private Sub Command4_Click()
Text1.Text = Text1.Text + "4"
End Sub
Private Sub Command5_Click()
Text1.Text = Text1.Text + "5"
End Sub
Private Sub Command6_Click()
Text1.Text = Text1.Text + "6"
End Sub
Private Sub Command7_Click()
Text1.Text = Text1.Text + "7"
End Sub
Private Sub Command8_Click()
Text1.Text = Text1.Text + "8"
End Sub
Private Sub Command9_Click()
Text1.Text = Text1.Text + "9"
End Sub
Private Sub Command10_Click()
Text1.Text = Text1.Text + "0"
End Sub
Private Sub Command20_Click()
Text1.Text = Text1.Text + "."
End Sub
Private Sub Command12_Click()
If Text1.Text < " " Then
Text1.Text = Mid(Text1.Text, 1, Len(Text1.Text) - 1 + 1)
Else
Text1.Text = Mid(Text1.Text, 1, Len(Text1.Text) - 1)
End If
End Sub
Private Sub Command13_Click()
Text1.Text = ""
End Sub
Private Sub Command14_Click()
Command14.Tag = 1
Command15.Tag = 0
Command16.Tag = 0
Command17.Tag = 0


temp = Text1.Text
Text1.Text = ""
End Sub
Private Sub Command15_Click()
Command14.Tag = 0
Command15.Tag = 1
Command16.Tag = 0
Command17.Tag = 0


temp = Text1.Text
Text1.Text = ""
End Sub
Private Sub Command16_Click()
Command14.Tag = 0
Command15.Tag = 0
Command16.Tag = 1
Command17.Tag = 0


temp = Text1.Text
Text1.Text = ""
End Sub
Private Sub Command17_Click()
Command14.Tag = 0
Command15.Tag = 0
Command16.Tag = 0
Command17.Tag = 1


temp = Text1.Text
Text1.Text = ""

End Sub

Private Sub Command18_Click()
If Command14.Tag = 1 Then
 Text1.Text = temp / Text1.Text
Else
If Command15.Tag = 1 Then
Text1.Text = temp * Text1.Text
Else
If Command16.Tag = 1 Then
Text1.Text = temp - Text1.Text
Else
If Command17.Tag = 1 Then
Text1.Text = temp + Text1.Text

End If
End If
End If
End If
End Sub
Private Sub Command11_Click()

Command1.Enabled = True

Command2.Enabled = True

Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Command8.Enabled = True
Command9.Enabled = True
Command10.Enabled = True
Command12.Enabled = True
Command13.Enabled = True
Command14.Enabled = True
Command15.Enabled = True
Command16.Enabled = True
Command17.Enabled = True
Command18.Enabled = True
Command19.Enabled = True
Command20.Enabled = True



End Sub

Could anyone help me for calculating percentage code and for the on/off codes?

For the percentage:

Dim x as Integer ' General Declaration Area

Private Sub cmdPRCNT_Click()
Text1.Text = x * (Val(Text1.Text) / 100)
End Sub

On the On/Off button thingy, use a frame control and put all command buttons on it except the On/Off key.

On design time, set the Frame property Enable to True (its up to you).

On/Off button:

Private Sub OnOff_Click()

Public Operation as Double  ' General Declaration Area

Text1.Text = ""

Frame1.Enabled = Not Frame1.Enabled

If Frame1.Enabled Then
    Text1.Text = "0"
    Operation = 0
Else
    Exit Sub
End If
End Sub

Hope this Helps.. :)

Mark thread as solved. Please don't PM.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.