no response from print button and I've read all the posts

N

Nichelle

I've reveiwed all the previous posts/comments and tried to create a Print
button on my form - version 07. However, there is no response when I test
the button - no error message, nothing. And my form is fully trusted. I'm
including my code just in case I missed something. Also, I tried
thisXDocument.PrintOut(); and XDocument.PrintOut();
----------------------------------------------------------------
Imports Microsoft.Office.InfoPath
Imports System
Imports System.Xml
Imports System.Xml.XPath
Imports System.Windows.Forms
Imports mshtml




Namespace OPP_Expense_Report
Public Class FormCode
' Member variables are not supported in browser-enabled forms.
' Instead, write and read these values from the FormState
' dictionary using code such as the following:
'
' Private Property _memberVariable() As Object
' Get
' _memberVariable = FormState("_memberVariable")
' End Get
' Set
' FormState("_memberVariable") = value
' End Set
' End Property

' NOTE: The following procedure is required by Microsoft Office
InfoPath.
' It can be modified using Microsoft Office InfoPath.
Private Sub InternalStartup(ByVal sender As Object, ByVal e As
EventArgs) Handles Me.Startup
AddHandler
DirectCast(EventManager.ControlEvents("Print_Report"), ButtonEvent).Clicked,
AddressOf Print_Report_Clicked
End Sub

Public Sub Print_Report_Clicked(ByVal sender As Object, ByVal e As
ClickedEventArgs)
' XDocument.PrintOut();
End Sub
End Class
End Namespace
 
R

RSorrell2

Hello

First create a print view which is another view that is identical to
your form but is used only for printing

Then add a button - Rules and Custom Code, Label it Print

In the Edit Form Code add this:

function Print::OnClick(eventObj)
{
//To print:
XDocument.PrintOut();
}

If you want to switch to the print view use this:

function Print::OnClick(eventObj)
{
//To Switch View:
XDocument.View.SwitchView("Print View");
//To print:
XDocument.PrintOut();
//Switch back to main view:
XDocument.View.SwitchView("View 1");
}

This should work for you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top