In Visual Basic (VB), a simple calculator can be created using a Windows Forms application. Here’s a basic code snippet for a simple calculator that performs addition:
Public Class Calculator
Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
Dim num1 As Double = Convert.ToDouble(txtNum1.Text)
Dim num2 As Double = Convert.ToDouble(txtNum2.Text)
Dim result As Double = num1 + num2
lblResult.Text = "Result: " & result.ToString()
End Sub
End Class
This code assumes you have two text boxes (txtNum1
and txtNum2
), a button (btnAdd
), and a label (lblResult
) on your form to display the result. You can extend this by adding more buttons and operations for subtraction, multiplication, and division.
high level language
Yes it is possible, most things are in VB
vb or vb
vb or vb
you dont make vb vb is visual basics and you make stuff in it
viva question for vb
No. VB 6.0 is a much older version of Visual BASIC, dating back to 1998. VB 2010 is a modern version.
cvghnvb vb vb
well there is lot of thing you can use in the vb
VB Vágur was created in 1905.
form1.vb
No Return statement in VB programming