answersLogoWhite

0

What is function in vb net?

User Avatar

Anonymous

11y ago
Updated: 8/20/2019

1st, I hope you do know what a 'sub' is, if you don't, anyways its like a paragraph that includes codes to be executed when an event happens, as button.click event or mousehover event

a function is like a sub but returns a value, and does the same work of a variable, for example you can make a function for adding numbers:

private function Name_Of_Your_Function(Byval num1 as integer,byval num2 as integer) as integer

and now u made a function that dims 2 variables (num1, num2) and returns an integer (as integer)

now we type inside it:

dim num3 as integer

num1 + num2 = num3

return num3

notice the return cmd, u can also type: Name_Of_Your_Function = num3

Notice that we didnt dim the num3 in the function declaration ull know why later

now put 2 textboxs and a button and in the Sub of the button add:

dim frstnum, scndnum as integer

and assign them the textboxs input

now to call out function we right its name:

Name_Of_Your_Function()

now we put in the brackets the old num1 and num2,, but as whatever we want, so if we want to add 1 and 6 we do:

Name_Of_Your_Function(1, 6)

now we want to add variables frstnum and scndnum so we will do

Name_Of_Your_Function(frstnum, scndnum)

and now to get the result we'll get the value of the function, remember?

so we wil assign the value of that function to a new variable for us to use

dim answer as integer

answer = Name_Of_Your_Function

And then add a label and do label1.text = answer

and your done!

You successfully used a function

I hope you understood the consept, you can make functions return other things than integers tho, as strings and booleans

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

What is a difference between dotnet and VB?

Nothing, as VB is now part of .Net. .Net contains following main languages: - C# - VB However, VB 6 was before .Net and was independent. dotnet is a framework that supports multiple languages and vb is one the language supported by dotnet.


What are the types of Dot-net?

totally there are 3 types C # Asp dot net Vb dot net


What is meant by vb net framework?

Vb(visual basic) is the language support by a .Net framework.we can use the vb as a windows application and web application and use the many application we can create.


What should you study first java or vb or net?

Java


What is a list of net supported languages?

C#, vb, j#


VB Net Common Control And Its Properties?

common controls and its properties


What is Job description of VB net developer?

job description of vb.net developer


Where can tutorial for VB net be found?

There are many places one might find a tutorial for VB net. The most readily available resource would most likely be on the official brand website or from one's local library.


What is the meaning of dot net?

.net is technology in which we can design application as we wish and can write code in c# or vb anyone language


What is a Str function in VB?

Str converts a number to a string.


Does vb support pointer to function discuss?

It doesn't discuss.


For beginners Suggest a good reference book to learn C Sharp VB Net ADO Net ASP Net for Ms Developer Studio 2005 also suggest books for ASP VB Script Java Script Java Core Java and VB 6.0?

There are ofcourse good books friend... Among them u can try "Programming in c#" by Oreily publications