Page level procedure (VB.net) : Function « Language Basics « ASP.Net

ASP.Net
1. ADO.net Database
2. Ajax
3. Asp Control
4. Collections
5. Components
6. Data Binding
7. Development
8. File Directory
9. HTML Control
10. Language Basics
11. Login Security
12. Mobile Control
13. Network
14. Page
15. Request
16. Response
17. Server
18. Session Cookie
19. Sitemap
20. Theme Style
21. User Control and Master Page
22. Validation by Control
23. Validation by Function
24. WebPart
25. WPF
26. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
ASP.Net » Language Basics » Function 
Page level procedure (VB.net)

<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
    If IsPostBack Then
        DisplayInstructions("Final")
    Else
        DisplayInstructions("Initial")
    End If    
End Sub

Sub SubmitBtn_Click(Sender As Object, E As EventArgs)
    lblResult.Text = "Result: " & AddNums_
        txtNumber1.Text, txtNumber2.Text)
End Sub

Sub DisplayInstructions(Mode as String)
    If Mode = "Initial" Then
      lblInstructions.Text = "Enter two numbers that " _
          "you want to add."
    Else
      lblInstructions.Text = "The results are " _
          "below."
    End If
End Sub
Function AddNums(Num1 as Single, Num2 as Singleas Single
   AddNums = Num1 + Num2
End Function
</script>
<HTML>
<HEAD>
<TITLE>Creating Your Own Procedures</TITLE>
</HEAD>
<Body LEFTMARGIN="40">
<form runat="server">
<asp:label
    id="lblInstructions" 
    runat="server"
/>
<BR><BR>
Enter a number:<BR>
<asp:textbox 
    id="txtNumber1" 
    runat=server 
/>
<BR><BR>
Enter a second number:<BR>
<asp:textbox 
    id="txtNumber2" 
    runat=server 
/>
<BR><BR>
<asp:button 
    id="butOK"
    text="Add"
    onclick="SubmitBtn_Click" 
    runat="server"
/>
<BR><BR>
<asp:label
    id="lblResult" 
    runat="server"
/>
</Form>
</BODY>
</HTML>
           
       
Related examples in the same category
1. Define and call function in a page (VB.net)
2. Define function to change 'HR' length (C#)
3. Function Parameter passed by Reference (C#)
4. Function Parameter passed by Value (C#)
5. Using out Parameters (C#)
6. Simple function without parameters (C#)
7. Define and call function (C#)
8. Call function (C#)
9. Function local variable (C#)
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.