G
Guest
Hello,
I have a program that does the following:
When a user clicks on a row in a VB.NET datagrid, it will open a web page in
Internet Explorer (that corresponds to that item in the selected row in the
datagrid). It will automatically print that web page, and then it will close
the Internet Explorer window. I have code that works perfectly when a
regular web page is opened, however when a pdf web page is opened the
printing never occurs. Any help would be greatly appreciated. The reason
for the datagrid is that ultimately the user should be able to select many
rows and have all the web pages print without any user intervention. Thank
you! Mrs_Mcse
My VB.NET code is:
If DataGrid1.IsSelected(0) = True Then
Dim selectedItem As Object
selectedItem = DataGrid1.Item(0, 4)
'For testing purposes, just use the first row in the datagrid
and use column 4 that contains a web url
Dim cellValue As String
cellValue = selectedItem
Dim Explorer As SHDocVw.InternetExplorer
Explorer = New SHDocVw.InternetExplorer
Explorer.Visible = True
Explorer.Navigate(cellValue)
Do
Loop Until Explorer.Busy = False
Explorer.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINTPREVIEW,
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER)
End If
I have a program that does the following:
When a user clicks on a row in a VB.NET datagrid, it will open a web page in
Internet Explorer (that corresponds to that item in the selected row in the
datagrid). It will automatically print that web page, and then it will close
the Internet Explorer window. I have code that works perfectly when a
regular web page is opened, however when a pdf web page is opened the
printing never occurs. Any help would be greatly appreciated. The reason
for the datagrid is that ultimately the user should be able to select many
rows and have all the web pages print without any user intervention. Thank
you! Mrs_Mcse
My VB.NET code is:
If DataGrid1.IsSelected(0) = True Then
Dim selectedItem As Object
selectedItem = DataGrid1.Item(0, 4)
'For testing purposes, just use the first row in the datagrid
and use column 4 that contains a web url
Dim cellValue As String
cellValue = selectedItem
Dim Explorer As SHDocVw.InternetExplorer
Explorer = New SHDocVw.InternetExplorer
Explorer.Visible = True
Explorer.Navigate(cellValue)
Do
Loop Until Explorer.Busy = False
Explorer.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINTPREVIEW,
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER)
End If