• At first open your visual basic application by clicking on the icon of visual basic 6.0 software from your desktop or your all program menu inside the start button .
• after clicking on it it will be for you and a screen will appear in front of you like the following picture i.e. (1.0)
picture (1.0)
• after that can see that there is a dialog box is appearing in front of you . from this dialog box you have to select the standard exe option i.e. pic (1.1)
pic(1.1)
• then click on the open button i.e pic (1.2)
pic(1.2)
• Ater clicking on the open button one project and form will be open for you i.e. pic (1.3)
pic (1.3)
• Ater that go to the tool section of your visual basic software which is available in your left hand side in bar i.e. pic (1.4)
pic (1.4)
• From those tools select the icon which is looking like alphabet "A" to insert a label in your project i.e (1.5)
pic(1.5)
• After that draw a label in your form i.e pic (1.6) and single click on it and then go the property window in your write hand side from the property window select the Caption property and change caption from label1 to Enter first value i.e. pic (1.7) according to the same process insert a 2 more label in your form one for the second value and next one is for Result caption .
Pic (1.6)
pic (1.7)
(pic 1.7)
pic(1.7)
• After that you need to insert 2 text box in your form to get the input from the user to proceed the program and 1 text box for show the result of the program.to insert the text box in your form go to the tool menu and select the text box option and draw it in your form i.e pic (1.8) after insert the text box in your form go to the property of your text box in your property window and clear the text property of the text box to clear the default text from your text box . according to those steps insert 3 text box in your form
pic (1.8)
pic (1.8)
pic (1.8)
pic (1.8)
• after inserting the the labels and the text box your form will look like that pic (1.9)
• now insert two command button to perform the operation . for insert the command button go to the tool bar select the command button option and insert it into your form to change the button caption you have to go to the property window from there you need to change the button caption from Command 1 to Calculate . and another button caption will be Clear . the calculate button will perform the operation of calculation and the clear button will help to clear the values from the text boxs.
• after completing the all above steps your form will look like this i.e: pic(2.1)
pic (2.1)
• After that you need to double click on the calculate button to write the respective code for the calculate operation . when you will click on it a window will open for you where you can write your code so it's time to write the code for calculate operation .
Private sub command2_click()
Dim a as integer
Dim b as integer
Dim c as integer
a = Cint(text1.text)
b = Cint(text2.text)
c = a+b
text3.text=c
end sub
• code for the clear button
private sub command1_click()
text1.text = " "
text2.text = " "
text3.text = " "
end sub
No comments:
Post a Comment