0% found this document useful (0 votes)
26 views

Visual Basic 3rd Semester (Amit)

This document contains code for 5 Visual Basic applications. The applications include: 1) A message box that prints "welcome to vb" 2) Arithmetic operations of addition, subtraction, multiplication, and division for two user-entered numbers 3) Message boxes that print messages for buttons labeled "Enter Name", "Ok", "Cancel", and "Exit" 4) Changing the form background color when text is changed in a text box 5) Demonstrating mouse events by changing a text label for mouse move, down, and up events

Uploaded by

Nitin Grover
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Visual Basic 3rd Semester (Amit)

This document contains code for 5 Visual Basic applications. The applications include: 1) A message box that prints "welcome to vb" 2) Arithmetic operations of addition, subtraction, multiplication, and division for two user-entered numbers 3) Message boxes that print messages for buttons labeled "Enter Name", "Ok", "Cancel", and "Exit" 4) Changing the form background color when text is changed in a text box 5) Demonstrating mouse events by changing a text label for mouse move, down, and up events

Uploaded by

Nitin Grover
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Sector-9, dwarka institutional area, adjusted to metro pilllar no- 1160

Submitted to Miss Charanpreet Kaur (subject incharge)

Submitted by Navita Aggarwal Course - BBA ( Gen) Enrolment 06224001710 Semester/ shift- IIIrd / IInd

Assignment -1

1) Design an application to print in the message box welcome to VB. Coding : Private Sub Command1_click() Msgbox (welcome to vb) End Sub

AMIT

2) Design an application to perform the arithmetic operations of two numbers entered by the user. CODING:

a) FOR ADDITION:Private Sub command1_ click () Text3.text = val (text1.text) + val (text2.text)

b) FOR SUBTRACTION:Private Sub Command1_ click ()

Text3.text = val (text1.text) val (text2.text) End Sub

C) FOR MULTIPLICATION:-

Private Sub Command1_ click () Text3.text= val (text1.text) * val (text2.text)

End Sub

d) FOR DIVISION:Private Sub Command1_ click ()

Text3.text= val (text1.text) / val (text2.text) End Sub

3) Write a program to display the following messages :-

Enter Name Ok Cancel Exit

OUTPUTS: CODE FOR COMMAND 1 Private Sub Command1_ click () Msgbox (hello + text1.text) End Sub

CODE FOR COMMAND 2 Private Sub Command2_ click ()

Msgbox (bye + text1.text) End Sub

CODE FOR COMMAND 3 Private Sub Command3_ click () End End Sub

4) Design an application such that when the user changes the text in text box the background of the form changes.

Output:Private Sub text1 _ change () Text1. Backcolor =vbRed End Sub

Design an application such that when the user changes the text in text box the background of the form changes. Output:-

Private Sub text1 _ change () Text1. Backcolor =vbblack End Sub

5) Design an application to show the usage of different events. Labels: Label 1- mouse move

Label 2- mouse down Label 3- mouse up OUTPUT: For mouse move : Private Sub Lable1_ mouse move ()

Text1.text = move End Sub

FOR MOUSE DOWN:

Private Sub Lable2_ mouse down () Text1.text = down End Sub

FOR MOUSE UP: Private Sub Lable3_ mouse up () Text1.text = up End Sub

You might also like