Detailed description of asp.net function definition return value calling method (vb.net/c #)

Source: Internet
Author: User

Asp tutorial. net function definition return value calling method detailed description (vb.net/c#), home page let's look at a vb.net in asp.net tutorial to create a function practices, as shown below

<Script runat = "server" language = "VB">

Function getName () As String
Return ""
End Function

Sub Page_Load (s As Object, e As EventArgs)
MessageLabel. Text = getName ()
End Sub
</Script>

It is very simple, just like vb.net development.

C #

<Script runat = "server" language = "C #">

String getName ()
      {
Return "Abc ";
      }

Void Page_Load ()
      {
MessageLabel. Text = getName ();
      }
</Script>


Returns a value instance using a function.

 

<Script runat = "server">
Sub Page_Load (obj as object, e as eventargs)
Response. Write (MultiplyNumbers (8, 9) & "<br> ")
   
Response. Write (MultiplyNumbers (4, 12) & "<br> ")
   
Response. Write (MultiplyNumbers (38,23) & "<br> ")
End sub

Function MultiplyNumbers (intA as integer, intB as integer )_
As Integer
Return intA * intB
End function
</Script>

On the asp.net page, how do we call functions and view instances?

<% @ Page Language = "C #" %>

<Script runat = "server">
Void Page_Load (Object Sender, EventArgs e ){
MultiplyNumbers (8, 9 );

MultiplyNumbers (4, 12 );

MultiplyNumbers (38,23 );
   }

Void MultiplyNumbers (int intA, int intB ){
Response. Write (intA * intB + "<br> ");
   }
</Script>

<Html> <body>

</Body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.