|
|||||||||||||||||
![]() |
![]() |
![]() |
|||||||||||||||
| How to Make a Function in VB? <VB Tutorial | Contents | Previous | Next > As example of function procedure, now you will make a simple function to compute hypotenuse of a right triangle that is the longest side of triangle facing the perpendicular angle.
Start making a new standard Exe project. Put one label and two text boxes in the form and one command button and change the Text property of the 2 textboxes into any numbers. Then copy and paste the function code below in the declaration section of your form or standard module.
Run the program, fill the two text box with numbers and click the command button. In the example above the function Hypotenuse take two integer arguments A and B and then return the computation value (by repeating the name of the function) to the caller. In this case the caller is Command1_Click event procedure. Then, the caller put the return value into label Note: You call a Function procedure the same way you call any of the built-in functions in VB <VB Tutorial | Contents | Previous | Next > Rate this tutorial or give your comments about this tutorial Preferable reference for this tutorial is Teknomo, Kardi. Visual Basic Tutorial . http:\\people.revoledu.com\kardi\ tutorial\VB
|
|||||||||||||
|
||||||||||||||
|
||||||||||||||