Academic Tutorials



English | French | Portugese | German | Italian
Google

Home Source Codes E-Books Downloads Contact Us About Us

VB.NET
Introduction to VB.NET
Visual Basic Scripts
Variables and Data Types
Arrays and Collections
Arithmetic and String Operations
Relational and Logical Operations
Math and String Functions
Date and Time Functions
Display Formats
Subprograms
Functions
The If Statement
The If...Else Statement
The Else...If Statement
The Select...Case Statement
The For...Next Statement
The For Each...Next Statement
The While...End While Statement
The Do...Loop Statement

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
AJAX Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PHP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
.NET (dotnet)
Microsoft.Net
XML Web Services
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills


Functions
Previous Next


Create an ArrayList

Functions are like subprograms, except they talk back -- they return a data value to the calling statement and functions can be passed arguments, if needed, or they can operate without information being fed to them



Function Formats

The general format for a function is given below.

Function name (argument As type [, argument As type]...) [As type]

...statements

[Return value]
[Exit Function]

End Function
The following example shows a function named Get_Area which calculates the area of a rectangle and when supplied with height and width dimensions by the calling statement.
<SCRIPT runat="server">
Sub Rectangle
Dim Width As Integer = 10
Dim Height As Integer = 5
Dim Area As Integer
Area = Get_Area(Width, Height)
End Sub

Function Get_Area (Width As Integer, Height As Integer) As Integer
Get_Area = Width * Height
Exit Function
End Function

</SCRIPT>



Calling Functions from ASP.NET Pages

Very often rather than from a subprogram,a function is called from a server control coded on the page. During data binding,this routinely happens. A simple example is shown below where the current date is embedded on the page when it loads and the date is supplied by a function call.

<SCRIPT runat="server">

Sub Page_Load
Page.DataBind()
End Sub

Function Get_Date() As String
Get_Date = FormatDateTime(DateString, DateFormat.LongDate)
End Function

</SCRIPT>

<b>Today's date is <%# Get_Date %></b>

The binding expression <%# Get_Date %> is a call to the function, whose returned value replaces the call when Page.DataBind() is executed in the Page_Load procedure and similar function calls are made when binding calculated data to <asp:Repeater>, <asp:DataGrid>, and <asp:DataList> controls.




Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • connotea
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Netvouz
  • RawSugar
  • Reddit
  • scuttle
  • Shadows
  • Simpy
  • Smarking
  • Spurl
  • TailRank
  • Wists
  • YahooMyWeb

Previous Next

Keywords: Functions in VB.NET, visual basic functions, vb net functions, functions in vb net, pl sql functions, function in vb net, substring in vb net, string functions in vb net, split function in vb net, format function in vb net, date functions in vb net, date function in vb net, php functions, perl functions, javascript functions, oracle functions, derivative functions, calculus functions, vb6 functions


HTML Quizes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
XML Quizes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizes
JavaScript Quiz
VBScript Quiz
AJAX Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizes
ASP Quiz
PHP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
.NET (dotnet) Quizes
Microsoft.Net Quiz
XML Web Services Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
Multimedia Quizes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Web Building  Quizes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Java Quizes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Programming Langauges Quizes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Soft Skills Quizes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz

Privacy Policy
Copyright © 2003-2008 Vyom Technosoft Pvt. Ltd., All Rights Reserved.