Search Tools Links Login

Easy Math


Visual Basic 6, or VB Classic

Do math, add, subtract, multiply, divide

Original Author: Demian Net

API Declarations

Option Explicit

Public Sub Multiply(X As Integer, Y As Integer)
Dim Z
Z = X * Y
Text3.Text = Str(Z)
End Sub

Public Sub Subtract(X As Integer, Y As Integer)
Dim Z
Z = X - Y
Text3.Text = Str(Z)
End Sub

Public Sub Add(X As Integer, Y As Integer)
Dim Z
Z = X + Y
Text3.Text = Str(Z)
End Sub

Public Sub Divide(X As Integer, Y As Integer)
Dim Z
Z = X / Y
Text3.Text = Str(Z)
End Sub

Code

'Make a Command1
'Make a Text1
'Make a Text2
'Make a Text3 (Locked)

'Add
Private Sub Command1_Click()
Add Text1, Text2
End Sub

'Subtract
Private Sub Command1_Click()
Subtract Text1, Text2
End Sub

'Multiply
Private Sub Command1_Click()
Multiply Text1, Text2
End Sub

'Divide
Private Sub Command1_Click()
Divide Text1, Text2
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 99 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.