Calculation
>> Nov 28, 2010
Let's start little project, how to calculate of two text box, put the two text box on the form and also insert one label under two text boxes, command button too.
right click on command button, now you can see properties of command button,click on last option"properties", now you can see control properies of command button, might it can be open as defult when you open first time visual basic. Go to control properies and type in forth option "caption"- "calculate" now you can see there command button caption will be cange.
right click on command button, now you can see properties of command button,click on last option"properties", now you can see control properies of command button, might it can be open as defult when you open first time visual basic. Go to control properies and type in forth option "caption"- "calculate" now you can see there command button caption will be cange.
you can see top of right side picture, you can set like that.
Now, you can change some text box's value by control properties, click on text box1 and go to text, type there 10 or any numner value and same follow in text box2. make any name of label, here i will given name of label is "total" and against text i put value = "0" , you can also give any instruction on top of form like " Please input numberic value in text boxes", change the colour and font bold for atraction.
Now, double click on command button, now you can see like this
Private Sub Command1_Click()
End Sub
Private Sub Command1_Click()
End Sub
- Enter the code
Private Sub Command1_Click()
Total = Val(Text1.Text) + Val(Text2.Text)
End Sub
Mark there TOTAL is label name means - label(total) caption will be (equal to) value text box 1 plus text box 2
Now, RUN the program -- You can run button in toolbar as like play button like ">"this.
enter numbric values in both textbox an click on calcuate button, you can see label valued will be automatically change there.
Cang! you almost done!
0 comments:
Post a Comment