graphics user interface lab manual

26
SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY, NEW RAIPUR(C.G.) GUI PROGRAMMING LAB CSE/4 th /GUI Lab/Prepared by Vivek Kumar Sinha

Upload: vivek-kumar-sinha

Post on 12-Jan-2017

67 views

Category:

Engineering


9 download

TRANSCRIPT

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

GUI

PROGRAMMING

LAB

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

EXPERIMENT NO-1

Design & identify card containing information regarding students such as Name,Roll No.,Address,Class Studying,Date Of Birth,Blood Group,Phone No.,etc .Add a Exit Button.

Property Setting:

Property of Name label box

Name=label1

Caption=Name

Property of Roll No label box

Name=label2

Caption= Roll No

Property of Address label box

Name=label3

Caption= Address

Property of Class label box

Name=label4

Caption= Class

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

Property of Date Of Birth label box

Name=label5

Caption= Date Of Birth

Property of Blood Group label box

Name=label6

Caption= Blood Group

Property of Phone No label box

Name=label7

Caption= Phone No

Property of Text box

Name=Text1

Caption=""

Property of Text box

Name=Text2

Caption=""

Property of Text box

Name=Text3

Caption=""

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

Property of Text box

Name=Text4

Caption=""

Property of Text box

Name=Text5

Caption=""

Property of Text box

Name=Text6

Caption=""

Property of Text box

Name=Text7

Caption=""

Property of Exit command button

Name=Command1

Caption=Exit

 Source Code:

Private Sub cmd_Exit_Click()

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

Unload Me

End Sub

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

EXPERIMENT NO-2

Develop an application to calculate Interest. It should accept rate of interest, period for calculation of interest (years), amount on which interest is to be calculated (Rs.). After clicking Compute Investment amount (Principal + Interest) should be displayed in separate text box. Add Exit button, Proper text box controls and labels to be used. Provide 2 options- Simple, Compound interest. Provide Picture and Radio Button control.

Property Setting:

Property of Principal label box

Name=label1

Caption= Principal

Property of Rate label box

Name=label1

Caption= Rate

Property of Time label box

Name=label1

Caption= Time

Property of Result label box

Name=label1

Caption= Result

Property of Text box

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

Name=Text1

Caption=""

Property of Text box

Name=Text2

Caption=""

Property of Text box

Name=Text3

Caption=""

Property of Text box

Name=Text4

Caption=""

Property of SI command button

Name=Command1

Caption=SI

Property of CI command button

Name=Command2

Caption=CI

Property of clear command button

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

Name=Command3

Caption=clear

Property of Exit command button

Name=Command4

Caption=Exit

 Source Code:

Private Sub cmd_SI_Click()

Text4.text=((Text1.text*Text2.text*Text3.text)/100)

End Sub

Private Sub cmd_CI_Click()

Text4.text=(Text1.text*(1+(Text2.text/100))^Text3.text)

End Sub

Private Sub cmd_Clear_Click()

Text1.text=””

Text2.text=””

Text3.text=””

Text4.text=””

End Sub

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

Private Sub cmd_Exit_Click()

Unload Me

End Sub

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

EXPERIMENT NO-3

Design a Simple Calculator to implement addition, subtraction, multiplication, division, remainder operations.

Property Setting:

Property of enter first number label box

Name=label1

Caption= enter first number

Property of enter second number label box

Name=label1

Caption= enter second number

Property of Result label box

Name=label1

Caption= Result

Property of Text box

Name=Text1

Caption=""

Property of Text box

Name=Text2

Caption=""

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

Property of Text box

Name=Text3

Caption=""

Property of Addition command button

Name=Command1

Caption= Addition

Property of Subtraction command button

Name=Command2

Caption= Subtraction

Property of Multiply command button

Name=Command3

Caption= Multiply

Property of Division command button

Name=Command4

Caption= Division

Property of Clear command button

Name=Command5

Caption= Clear

 Source Code:

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

Private Sub cmd_Addition_Click()

Text3.text=(Text1.text+Text2.text)

End Sub

Private Sub cmd_Subtraction_Click()

Text3.text=(Text1.text-Text2.text)

End Sub

Private Sub cmd_Multiply_Click()

Text3.text=(Text1.text*Text2.text)

End Sub

Private Sub cmd_Division_Click()

Text3.text=(Text1.text/Text2.text)

End Sub

Private Sub cmd_Clear_Click()

Unload Me

End Sub

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

EXPERIMENT NO-4

Create a form using check box and option box to giveeffect for fonts such as bold, italic, underline strike through respectively for the text entered in the rich text box.Program to display message in message box.

Property Setting:

Property of Print command button

Name=Command1

Caption=Print

Source Code:

Private Sub cmd_Print_Click()

Print "Hello"

MsgBox "Welcome To the World of Visual Basic"

End Sub

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

EXPERIMENT NO-5

Demonstrate use of Date Environment, add tables and queries, place fields on form, report etc..Design a program to calculate Factorial.

Property Setting:

Property of enter number label box

Name=label1

Caption= enter number

Property of Text box

Name=Text1

Caption=""

Property of Calculate command button

Name=Command1

Caption= Calculate

Source Code:

Private Sub cmd_Calculate_Click()

Dim n As Integer, f As Double, I As Integer

f = 1

n = Val(Text1.Text)

If n > 170 Then

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

MsgBox "Buffer Overflow!"

Text1.Text = ""

Text1.SetFocus

Else

For I = 1 To n

f = f * I

Next I

MsgBox "Factorial of " & n & " is " & f

Text1.Text = ""

Text1.SetFocus

End If

End Sub

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

EXPERIMENT NO-6

Design a program to display regional languages of different states in India. Take many names of status of India in one listbox control and other text box control should display their languages e. g. Maharashtra _ Marathi etc.

Property Setting:

Property of List box

Name=List1

List= Maharashtra

Chhattisgarh

Punjab

Andhra Pradesh

Kerala

MP

Property of Text box

Name=Text1

Caption=""

Property of Show Language command button

Name=Command1

Caption= Show Language

Source Code:

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

Private Sub cmd_Show Language_Click()

If List1.Text = "Maharashtra" Then

Text1.Text = "Marathi"

ElseIf List1.Text = "Chhattisgarh" Then

Text1.Text = "Chhattisgarhi"

ElseIf List1.Text = "Punjab" Then

Text1.Text = "Punjabi"

ElseIf List1.Text = "Andhra Pradesh" Then

Text1.Text = "Telugu"

ElseIf List1.Text = "Kerala" Then

Text1.Text = "Tamil"

ElseIf List1.Text = "MP" Then

Text1.Text = "Hindi"

End If

End Sub

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

EXPERIMENT NO-7

Design a program to display regional languages of different states in India. Take many names of status of India in one list .box control and other text box control should display their languages e. g. Maharashtra _ Marathi etc.Program for Language selector.

Private Sub Command1_Click()

If List1.Text = "Maharashtra" Then

Text1.Text = "Marathi"

ElseIf List1.Text = "Chhattisgarh" Then

Text1.Text = "Chhattisgarhi"

ElseIf List1.Text = "Punjab" Then

Text1.Text = "Punjabi"

ElseIf List1.Text = "Andhra Pradesh" Then

Text1.Text = "Telugu"

ElseIf List1.Text = "Kerala" Then

Text1.Text = "Tamil"

ElseIf List1.Text = "MP" Then

Text1.Text = "Hindi"

End If

End Sub

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

EXPERIMENT NO-8

Create a Simple NotE pad application, which contains Menus, Rich Text Box, Common Dialog box, formatted text using Toolbar, and Replace text, Windows (Tile / Cascade), Status bar and scroll bar Program to draw a menu .

Private Sub mnuAddProject_Click()

Print "Another Project Added!"

End Sub

Private Sub mnuCopy_Click()

Print "Content Ready To Paste!"

End Sub

Private Sub mnuCut_Click()

Print "Content Ready To Paste!"

End Sub

Private Sub mnuDelete_Click()

Print "Deleted!"

End Sub

Private Sub mnuExit_Click()

End

End Sub

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

Private Sub mnuNewProject_Click()

Print "New Project Added!"

End Sub

Private Sub mnuOpenProject_Click()

Print "Existing Project Opened!"

End Sub

Private Sub mnuPaste_Click()

Print "Content Copied!"

End Sub

Private Sub mnuRedo_Click()

Print "Last Action Repeated!"

End Sub

Private Sub mnuRemoveProject_Click()

Print "Current Project Removed!"

End Sub

Private Sub mnuReset_Click()

Me.Cls

End Sub

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

Private Sub mnuSaveProject_Click()

Print "Project Saved!"

End Sub

Private Sub mnuSaveProjectAs_Click()

Print "Project Saved With Different Name!"

End Sub

Private Sub mnuUndo_Click()

Print "Returned to Previous State!"

End Sub

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha

SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY,

NEW RAIPUR(C.G.)

CSE/4th/GUI Lab/Prepared by Vivek Kumar Sinha