0% found this document useful (0 votes)
247 views3 pages

VB6 Simple Calculator Code Guide

This document provides a Visual Basic 6 (VB6) code for a simple calculator application. It includes functionality for basic arithmetic operations such as addition, subtraction, multiplication, and division, along with a user interface for inputting numbers. The code handles button clicks to input numbers and perform calculations based on the selected operator.

Uploaded by

shravankudale62
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
247 views3 pages

VB6 Simple Calculator Code Guide

This document provides a Visual Basic 6 (VB6) code for a simple calculator application. It includes functionality for basic arithmetic operations such as addition, subtraction, multiplication, and division, along with a user interface for inputting numbers. The code handles button clicks to input numbers and perform calculations based on the selected operator.

Uploaded by

shravankudale62
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

//Design Simple Calculator Using VB6

Option Explicit
Dim a As Double
Dim b As Double
Dim operator As String

Private Sub Command1_Click()


[Link] = [Link] + "1"
End Sub

Private Sub Command10_Click()


[Link] = [Link] + "0"
End Sub

Private Sub Command11_Click()


a = Val([Link])
operator = "+"
[Link] = ""
End Sub

Private Sub Command12_Click()


a = Val([Link])
operator = "-"
[Link] = ""
End Sub

Private Sub Command13_Click()


a = Val([Link])
operator = "/"
[Link] = ""
End Sub

Private Sub Command14_Click()


a = Val([Link])
operator = "*"
[Link] = ""
End Sub

Private Sub Command15_Click()


[Link] = ""
End Sub

Private Sub Command16_Click()


Dim result As Double
b = Val([Link])
If operator = "+" Then result = a + b
If operator = "-" Then result = a - b
If operator = "*" Then result = a * b
If operator = "/" Then result = a / b
[Link] = result
End Sub

Private Sub Command17_Click()


End

End Sub

Private Sub Command2_Click()


[Link] = [Link] + "2"
End Sub

Private Sub Command3_Click()


[Link] = [Link] + "3"
End Sub

Private Sub Command4_Click()


[Link] = [Link] + "4"
End Sub

Private Sub Command5_Click()


[Link] = [Link] + "5"
End Sub

Private Sub Command6_Click()


[Link] = [Link] + "6"
End Sub

Private Sub Command7_Click()


[Link] = [Link] + "7"
End Sub

Private Sub Command8_Click()


[Link] = [Link] + "8"
End Sub

Private Sub Command9_Click()


[Link] = [Link] + "9"
End Sub
//Design:

//Output:

You might also like