Cannot open saved file


#1

Hello Ken,

you remember I ask you how to save PDF file in another unique name? finally i found the way. however. I cannot open it after save.

Can you tell me what 's wrong? Error message when opening form: "There was an error opening this document. A File read orror has occured.)

Dim fsLabel As FileStream = New FileStream(“C:\BarCodeOutput” & TicketNumber.Text & “.pdf”, FileMode.Create)

Dim Label As Form = New Form(“C:\BarCodePrint.pdf”, “fsLabel”)


#2

Dear jyuen,

1)Will you still operate the output stream after executing form.Save()? If not, you could just use the the following constructor, the file will be created and closed simply and correctly:

Dim Label As Form = New Form(“C:\BarCodePrint.pdf”, “C:\BarCodeOutput” & TicketNumber.Text & “.pdf”)

2) If the problem still occurs, please tell me the code of your basic operation about the form and the new output stream. Or send me the complete code and template, i will test it for you.

Best regards.


#3

Thank you very much!! it works