Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Pro Visual Basic 2005
|
Pro Visual Basic 2005 For advanced Visual Basic coders working in version 2005. Beginning-level questions will be redirected to other forums, including Beginning VB 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Visual Basic 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 2nd, 2009, 04:53 AM
Registered User
 
Join Date: Dec 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error when calling Flush method.

I receive an error when I called the Flush method.
The error is "Cannot close stream until all bytes are written"

This happens only if the character in stringbuilder is more than 10000 characters or so...

Any Ideas?

Public Sub CreateWebPage()

If _Response Is Nothing Then
Throw New Exception("Web response is set to nothing.")
End If
Dim stringbuilder As New System.Text.StringBuilder
stringbuilder.AppendFormat("<html><title>{0}</title><body>{1}</body></html>", _Title, WebPageBody)
With _Response
.ContentType = "text/html"
.ContentEncoding = Encoding.UTF32
.ContentLength64 = stringbuilder.Length
Try

Using writer As New StreamWriter(.OutputStream)
With writer
.Write(stringbuilder.ToString())
.Flush()
End With
End Using
Catch ex As Exception
Throw ex
Finally
.Close()
End Try
End With
End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling Java Method via javascript basildudin J2EE 5 October 16th, 2008 12:00 AM
Calling a btn_click method dhirajDac ASP.NET 2.0 Professional 2 April 18th, 2008 07:52 AM
Calling a function on every method call Takashi321 General .NET 1 September 21st, 2007 09:33 AM
Error calling a method in the webservice madhusrp .NET Web Services 1 April 12th, 2007 08:54 AM
calling private method from another class jack_3 C# 3 December 16th, 2005 07:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.