title: Hide parameter panel after submit devexpress
body: <p>I am working with devexpress xtrareports to preview reports for my windows forms application. i have 2 parameters in the report and so when the preview window shows up the parameter panel is open, so the end user can select the parameters and click  on submit.
  I want to close the parameter panel after the end user has pressed submit. 
  I have researched on how to do this and i came across this solution <a href="https://www.devexpress.com/Support/Center/Question/Details/Q439200/how-to-hide-the-parameter-panel-after-submitting-parameter-values" rel="nofollow noreferrer">this solution on the devexpress site</a></p>
  
  <p>but when i implement it in my project it gives a null reference error</p>
  
  <p>the code code i got from the site is below</p>
  
  <pre><code>    private void XtraReport1_ParametersRequestSubmit(object sender, DevExpress.XtraReports.Parameters.ParametersRequestEventArgs e)
      {
          ReportPrintTool tool = ((XtraReport1)sender).ReportPrintTool as ReportPrintTool;
          if (tool != null)
          {
              PrintControl control = tool.PreviewForm.PrintControl;
  
              foreach (DockPanel panel in control.DockManager.Panels)
                  if (panel.Text == PreviewLocalizer.GetString(PreviewStringId.ParametersRequest_Caption))
                  {
                      control.DockManager.RemovePanel(panel);
                      break;
                  }
  
              this.RequestParameters = false;
          }
  
      }
  </code></pre>
  
  <p>it crashes on the foreach line because the dockmanager is null. Can i get some help on hiding the parameters panel after the submit button is clicked in a devexpress reportprinttool.</p>
  
  <p>If i check whether it is null first before running the foreach loop then it simply does not run and the parameter panel stays. 
   I am using devexpress version 18.1. Visual studio 2017 enterprise on a windows 10 operating system. and the language is c#</p>