Results 1 to 3 of 3

Thread: Printing to a file

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    3

    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:
    1. Print #FileNum, "</table>"
    2. Print #FileNum, "<hr />"
    3. Print #FileNum, "<hr />"
    4. Print #FileNum, "<table class=" & Chr(34) & "style8" & Chr(34) & " style=" & Chr(34) & "width: 100%" & Chr(34) & ">"
    5. Print #FileNum, " <tr>"
    6. 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.

  2. #2
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    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

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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
  •  



Click Here to Expand Forum to Full Width