I have almost solved my problem. I have several more views, but only concerned with 3 views for this problem; 1) default view, 2) print view (blank form), 3) print view (completed form)
I have two buttons that operate similarly: on click, they switch to another view then print it via code.
The problem: one button (#2 below) works like I want it to (start on default view, switch to another view, print, return to default view)
The other button (#1 below) does the same steps except it does not return to the default view. It doesn't matter which order I click the buttons, they consistently behave different from each other (Button #2 is desired behavior, #1 is not). As far as my eye can see the code is identical with exception of the views I'm printing. Can someone tell me why they behave differently?
Here is the code:
//Button #1 (does not return to default view after print)
public void CTRL447_5_Clicked(object
sender, ClickedEventArgs e) //"Print blank form" button
{
// Write
your code here.
try
{
//switch
to another view
//this.ViewInfos.SwitchView("View
1B - Print Main (Blank)");
this.ViewInfos.Initial
= this.ViewInfos["View
1B - Print Main (Blank)"];
}
catch
(COMException ex)
{
string
msg = "Message: " + ex.Message + " Source: " + ex.Source;
}
//"Print
blank form" button
this.Print();
}
//Button #2 (does return to default view after print)
public void CTRL450_5_Clicked(object
sender, ClickedEventArgs e) //"Print" button
{
// Write
your code here.
try
{
//switch
to printer-friendly view
this.ViewInfos.Initial
= this.ViewInfos["View
1A - Print Main (Completed)"];
}
catch
(COMException ex3)
{
string
msg2 = "Message: " + ex3.Message +
" Source: " + ex3.Source;
}
//"Print"
button
this.Print();
}