Name

Write

Synopsis

Response.Write(ByVal ch As Char)
Response.Write(ByVal obj As Object)
Response.Write(ByVal s As String)
Response.Write(ByVal buffer( ) As Char, ByVal index As Integer, _
   ByVal count As Integer)

Allows writing of arbitrary content to the output stream. Content may be character data, an Object (using the object’s ToString( ) method), or String data.

Parameters

ch

A Char argument containing a character to write to the output stream.

obj

An Object argument containing an object whose string representation will be written to the output stream.

s

A String argument containing text to write to the output stream.

buffer( )

A Char array argument containing the characters to write to the output stream.

index

An Integer argument containing the starting point in the Char array from which to being writing.

count

An Integer argument containing the number of characters to write.

Example

The example creates an array of Chars, sets the values of the Chars, and then loops through the array and displays its contents by calling Response.Write:

Sub Page_Load(  )
   Dim MyChars(2) As Char
   Dim MyChar As Char
   MyChars(0) = CChar("A")
   MyChars(1) = CChar("B")
   MyChars(2) = CChar("C")
   For Each MyChar in MyChars
      Response.Write(MyChar)
   Next
End Sub

Notes

As shown above, the Write method in ASP.NET gains a number of new overloaded implementations. The above code could also be written by using another overloaded implementation that accepts an array of Chars, a starting index, and the count of Chars to ...

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.