[Excel] Print Preview Problem

chenz

New member
Joined
Mar 24, 2010
Messages
1
Programming Experience
Beginner
Hi Guys...

I am new to this thread as i am new to vb programming.

now, the problem is that in my application i m generating sql database. the data is displayed in datagridview. the user has a facility to filter data according to certain parameters. once filtered, user should be able print or perview the data. for the printing purpose i m writing the filtered data to excel sheet which is displayed in another tab. from here he can give print or printpreview command.

catch : when the user clicks print command, every thing works fine. i.e. print dialog comes up and on ok sheet gets printed. but when user issues print preview command, nothing nothing happens. preview window doesnt shows up.

version : vb express 2008, office : 2003

Private Sub PrintPreviewToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreviewToolStripMenuItem.Click
'Me.TabControl1.SelectTab(1)
If Not Populated Then Populate_Data()
PPrv = True
If Not Loaded Then
LoadBrowser()
Else
PPrv = False
WB2.ShowPrintPreviewDialog()
End If
End Sub

it first checks whether excel sheet is generated and data is written in it. if not does it and then loads that xl sheet in webbrowser and preview dialog is called in another routine but is exactly as is here. if already populated and loaded by some other routine then show print preview dialog.

note: print dialog is also used in exactly same way. it works perfect but preview doesnt. cant figure out whats the difference between them as both are webbrowser commands.

what could be the problem or is there any other way to do this?

any help or suggestions will be highly appreciated.
 
Back
Top