CommandBars object and ObjectWrapper - InfoPath Dev
in

InfoPath Dev

CommandBars object and ObjectWrapper

Last post 03-28-2007 12:38 AM by stzanev. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 03-23-2007 09:02 AM

    • stzanev
    • Not Ranked
    • Joined on 02-28-2007
    • Bulgaria
    • Posts 13

    CommandBars object and ObjectWrapper

    I am again faced with the issue of enabling/disabling InfoPath 2003 toolbars. In the MSDN Technical Articlehttp://msdn2.microsoft.com/en-us/library/aa192513(office.11).aspx there are examples of working with the CommandBars object using ObjectWrapper. Those examples work great from within my FormCode, but whenever I try to use the same technique outside of the managed code I get a InvalidCastException when casting the CommandBar object to the ObjectWrapper.
    Does anyone know how to access the CommandBars outside of the FormCode file.
  • 03-24-2007 07:54 AM In reply to

    Re: CommandBars object and ObjectWrapper

    Are you including all of the correct libraries? I would copy all of the using statements from the top of FormCode.cs into this other file to try and use it.

    If all else fails, why can't you just use it from the FormCode.cs file? We have done some really complicated forms but the most CS files I've ever had on an InfoPath form is 2: FormCode.cs and our home brewed Common.cs.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 03-27-2007 08:00 AM In reply to

    • stzanev
    • Not Ranked
    • Joined on 02-28-2007
    • Bulgaria
    • Posts 13

    Re: CommandBars object and ObjectWrapper

    Hi Matt,

    Yes I am using the exact same code and using statements.

    Here is the reason I am trying to do this outside of the FormCode:
    I have a C# Application that is used to pretty much control InfoPath (switch views, save, open, etc). I need a way to disable the toolbars, so the users only see a window that contains the form. Because, once those toolbars are disabled in a specific FormCode, they remain disabled application-wide, and do not show up when users use InfoPath separately from my application. I want to have a button in my application that will let the users re-enable the toolbars.

    Any suggestions?
  • 03-27-2007 09:12 PM In reply to

    Re: CommandBars object and ObjectWrapper

    Hm, sounds complicated, and you seem fully qualified on your hunt for a workaround! I have not worked in this scenario too much and I doubt that I could offer any more advice.

    Sorry and good luck! Let us now if you figure it out!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 03-27-2007 09:13 PM In reply to

    Re: CommandBars object and ObjectWrapper

    Hmmm... I just thought of something - could you use reflection? I've never used reflection and I don't really know much about it, but it seems to be the way to go to get at things not normally exposed.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 03-28-2007 12:38 AM In reply to

    • stzanev
    • Not Ranked
    • Joined on 02-28-2007
    • Bulgaria
    • Posts 13

    Re: CommandBars object and ObjectWrapper

    Yes, I am using Reflection to invoke the object. That is actually the problem. Reflection seems not to work outside of the form code.
    I will post if I find a solution.

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