I have an application who have multiple files .rtf i open it on a rich text box, but im having an issue
here is my code for print preview
开发者_Python百科PrintPreviewDialog1.Document = PrintDocument1
PrintPreviewDialog1.ShowDialog()
i press the button for preview and it shows me the preview.
but if i change the content of the rich text box with another file, the print preview shows me empty
any idea how i can send it to a new preview?
Looks like you've fallen in the pitfall of Magic Coding: where you just implement code, without exactly knowing what's going on in the API. There's very little information to go on, but first thing I would recommend is using the Debugger: set breakpoints to see exactly what data is being handled.
Apperently, data containing Nothing is being sent to the printpreview, thus the PrintDocument1 must be empty. I'd recommend not re-using the objects, but to reinstantiate them. So start with PrintPreviewDialog1 = new PrintPreviewDialog, setting it's settings, etc. Basically, follow any tutorial on Printing in VB.Net and make sure you re-instantiate the objects you're using.
精彩评论