Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a class to get output via Response.Wrtie

Status
Not open for further replies.

ehx6

IS-IT--Management
May 20, 2004
150
US
aspx coce :
---------------------
Private Sub btnTestOutputFromAspx_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTestOutputFromAspx.Click
Dim Name As String = "Bob"
Response.Write(Name)
End Sub

Private Sub btnbtnTestOutputFromClass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbtnTestOutputFromClass.Click
Dim MyCode As New CodeLibrary
MyCode.TestOutputDll("Test Output from a class")
End Sub
class code:
-----------------
Public Sub TestOutputDll(ByVal Name As String)
Response.Write(Name)
End Sub

I am not sure if I am not suppose to use Response.Write from within a class and I should get the value back to the aspx page as a return value then I do the following
Dim ReturnValue as string
Dim MyCode As New CodeLibrary
ReturnValue = MyCode.TestOutputDll
Response.Write ReturnValue

So which is the correct way . I am talking here concept issue. I am new to class programming and would like to learn the right way of doing things.
thanks
Ehx
 
Not sure what you're trying to do. In your other post I showed you how to access the Response object. As a rule though:
If you need to write to the output stream use the HtmlTextWriter class instead of the Response object from within your class.
 
Hi Veep,What is the namespace for HtmlTextWriter
I found System.Text ,but does not have what you mentioned.
Thanks
Ehx
 
As always, Google is your friend.

The number one hit for "HtmlTextWriter" is the MSDN documentation, which shows that it's in the System.Web.UI namespace.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top