Can i disable the infopath form screen while I run code in the background? - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Can i disable the infopath form screen while I run code in the background?

Last post 07-12-2016 11:38 AM by ISUGraber. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 07-08-2016 01:31 PM

    Can i disable the infopath form screen while I run code in the background?

     Is there a way I can disable the InfoPath form while I run commands in the background that are updating SQL Server tables via C#?

     Like what you can do with VB  : Application.ScreenUpdating = False

     

    If not does InfoPath have a progress bar I can call that I can update while the processing is being done?


    Thanks 

    Filed under: , ,
  • 07-11-2016 02:34 PM In reply to

    Re: Can i disable the infopath form screen while I run code in the background?

    Is this filler or browser? I think you are using a browser form, if I remember from other threads correctly... I wonder if you could change to an "in progress" view in your code at the beginning of execution, then switch back to the main view in code once your execution was complete? This would only work if your code is running off a button tho - IP won't let us change views on a field change....
    Hilary Stoupa

  • 07-12-2016 05:34 AM In reply to

    Re: Can i disable the infopath form screen while I run code in the background?

     Yes it is currently a web form and yes I am submitting this off of a button.  My button calls other procedures though.  I read about switching views before but am unsure how to do that since this is my first InfoPath form.  But I'll start looking into that more seriously now.

  • 07-12-2016 06:29 AM In reply to

    Re: Can i disable the infopath form screen while I run code in the background?

     So I got the Form to switch to my update view when the code begins.  And at the end I check to see if I'm still on that form and attempt to switch back. I got a com error. I looked it up and it says I can't switch views multiple times within code supposedly. Which seems like a very odd limitation. Below is my code to switch back to my default view. And below that is my error message.

    if (this.CurrentView.ViewInfo.Name == "Update")




    {



    //Switch back to original view


    this.ViewInfos.SwitchView("Request"); //Causes an error because apparently you can't switch between views within code.... more than once




     


     


    }


     

     

    System.Runtime.InteropServices.COMException
    InfoPath cannot execute any view-related object model calls. The view is not ready.
       at Microsoft.Office.Interop.InfoPath.SemiTrust.View.SwitchView(String bstrName)
       at Microsoft.Office.Interop.InfoPath.SemiTrust.ViewObjectWrapper.SwitchView(String bstrName)
       at Microsoft.Office.InfoPath.Internal.ViewInfoCollectionHost.SwitchView(String name)
       at QlikAcessRqst.FormCode.CTRL_Submit_Clicked(Object sender, ClickedEventArgs e)
       at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)
       at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)
     

  • 07-12-2016 08:06 AM In reply to

    Re: Can i disable the infopath form screen while I run code in the background?

    Ugh, I forgot about that.... Well - let's see. Rules run before code. Maybe your button could have a rule that switches views and your code could switch back? Don't know if that would work tho... Another option would be to put the main form stuff in a section, and a message in another section (on the same view) and have a helper field for hiding the main section and showing the helper section - we do that sometimes for emailing filler forms when we only want a little piece of the form's view in email. Then you set the helper field - the main section hides, the message section shows.... after you do your code stuff, you set the helper field back. Does that make sense?
    Hilary Stoupa

  • 07-12-2016 08:39 AM In reply to

    Re: Can i disable the infopath form screen while I run code in the background?

     Yeah that does make sense. I'm doing something like that for some of my fields within the form. So I'll see if I can get that to work.

     

    The rule didn't seem to work.  For whatever reason it didn't seem to switch the view until after my code ran and I'd still get an error.  It was rather odd.  I may try it again to see if I did something wrong but I'll try the section part first. 

  • 07-12-2016 08:51 AM In reply to

    Re: Can i disable the infopath form screen while I run code in the background?

    I'd go with sections since view switching is having a fit - actually, I'd probably test the 2 view switches in the browser first (with both in code) just to see if the form behaves differently in the browser. :)
    Hilary Stoupa

  • 07-12-2016 11:38 AM In reply to

    Re: Can i disable the infopath form screen while I run code in the background?

     Well either if I use a rule to set my textbox's value when the button I created is clicked or if I do it in code after it's clicked the textbox that my sections depend upon on to show visible or not doesn't get updated until the code is finished running through everything....

     

     Is there a command to refresh the form or something?

Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.