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

VB Ex

The document contains code to accept user input from a text box and display a greeting message or close the form. It also contains code to perform basic integer math operations like addition, subtraction, multiplication, and division and display the results in message boxes.

Uploaded by

Anish Babu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views3 pages

VB Ex

The document contains code to accept user input from a text box and display a greeting message or close the form. It also contains code to perform basic integer math operations like addition, subtraction, multiplication, and division and display the results in message boxes.

Uploaded by

Anish Babu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Ex 1 Accept a input and disp appro msg

txtName. btnOK(1) btnExit(2)

Code:- 1. Private Sub btnOK_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnOK.Click Display a message box greeting to the user MessageBox.Show("Hello, " & txtName.Text & _ "! Welcome to Visual Basic 2010.", _ "Hello User Message") End Sub 2.Private Sub btnExit_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnExit.Click End the program and close the form Me.Close() End Sub

Declare variable Dim intNumber As Integer Set number, add numbers, and display results intNumber = 16 intNumber = intNumber + 8 MessageBox.Show("Addition test. " & intNumber.ToString, _ "Integer Math") Set number, subtract numbers, and display results intNumber = 24 intNumber = intNumber 2 MessageBox.Show("Subtraction test. " & intNumber.ToString, _ "Integer Math") Set number, multiply numbers, and display results intNumber = 6 intNumber = intNumber * 10 MessageBox.Show("Multiplication test. " & intNumber.ToString, _ "Integer Math") Set number, divide numbers, and display results intNumber = 12 intNumber = CType(intNumber / 6, Integer) MessageBox.Show("Division test. " & intNumber.ToString, _ "Integer Math") End Sub

You might also like