|
-
Dec 9th, 2009, 09:21 AM
#1
Thread Starter
New Member
Printing to a file
Is there a limitation on how many characters you can print to a file?
I created an procedure that creates a html page like this
vb Code:
Print #FileNum, "</table>"
Print #FileNum, "<hr />"
Print #FileNum, "<hr />"
Print #FileNum, "<table class=" & Chr(34) & "style8" & Chr(34) & " style=" & Chr(34) & "width: 100%" & Chr(34) & ">"
Print #FileNum, " <tr>"
Print #FileNum, " <td class=" & Chr(34) & "style7" & Chr(34) & " style=" & Chr(34) & "width: 162px" & Chr(34) & "><strong>ITEM</strong></td>"
It just stops abruptly _ I cant figure out why. The above is just a sample form the middle of the procedure when I look at the html source - it just stops at about the same place but before the end. I've remmed out lines to see if it is the html but that it doesnt matter - it just stops writing to the file at the same place regardless of the code.
-
Dec 9th, 2009, 11:14 AM
#2
Re: Printing to a file
Have you tried making your HTML source code ( that you are printing ) smaller, something like this :
Code:
Print #FileNum, "</table><hr /><hr />"
Print #FileNum, "<table class=" & Chr(34) & "style8" & Chr(34) & " style=" & Chr(34) & "width: 100%" & Chr(34) & ">"
Print #FileNum, " <tr> <td class=" & Chr(34) & "style7" & Chr(34) & " style=" & Chr(34) & "width: 162px" & Chr(34) & "><strong>ITEM</strong></td>"
You don't have to write it line by line, only use 'single lines' where absolutely necessary
See if my logic would work
I would actually store the whole HTML variable in a variable, then, only write the variable to the file
VB.NET MVP 2008 - Present
-
Dec 10th, 2009, 03:25 AM
#3
Re: Printing to a file
do you get an error or does the code complete?
remove any error handling, especially on error resume next, to see if an error occurs
are you sending any characters that are invalid in a text file?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|