Tuesday, April 26, 2011

Program for add two Number




1. First step -Draw the user interface

Put two label , three text box and one command button








2. Secound Step-Assign properties to controls

label1

Name                         LblFirst
Caption          Enter First Number




Label2

Name             LblSecond
Caption          Enter Second Number

Text1
Name             TxtFirst
Text                


Text2             
Name             TxtSecond
Text                

Text3             
Name             TxtAns
Text                

Command1
Name             CmdAdd
Caption          Addition

Form
Name                         FrmAddition
Caption         Addition


Thired Step- Attach code to controls

  1. Double click addition buttn
you will see following two lins

Private Sub CmdAdd_Click()

End Sub

Private- that mean the action take only within procedure
Sub- mean sub routing or procedure
CmdAdd_Click()- mean CmdAdd bution action event this event is click
End Sub- end the procedure

Attach code as follows
Private Sub CmdAdd_Click()
txtAns = Val(TxtFirst) + Val(TxtSecond)
End Sub

Run Project press F5 or Click run button or Click Start on the run menu



.

No comments:

Post a Comment