Dll / Class Access [C#] - InfoPath Dev
in

InfoPath Dev

Dll / Class Access [C#]

Last post 02-21-2007 01:55 PM by Greg Collins. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 02-16-2007 10:17 AM

    • Biovox
    • Not Ranked
    • Joined on 02-16-2007
    • Posts 9

    Dll / Class Access [C#]

    I am creating a custom class which handles commonly used functions throughout multiple, seperate, forms. I hope to simply be able to create this class once, drop it into a project, and be able to use the functionality of it. Unfortunatly I don't seem to have access to the same objects that I do in my FormCode code-behind.

    To eliminate some of the issues, I added references to all the data my main form is using, but I simply don't know how to access my main forms xml. I'm not even sure what object, if any, I need to call to be able to use my main forms data sources. I don't even have a DataConnections object availible.

    For instance, when the form initally gets loaded, I call a class which maps my data connections to certain fields. Unfortuatly, there is functionality missing that would allow me to use a generic class.

    Does anyone have any experience with using custom classes/dll's within Infopath?
  • 02-16-2007 01:59 PM In reply to

    Re: Dll / Class Access [C#]

    Hi Biovox and welcome,
    Can you pass a pointer to your thisApplication or thisXDocument?
    Patrick Halstead
    Project Manager at Qdabra
  • 02-17-2007 11:04 AM In reply to

    • Biovox
    • Not Ranked
    • Joined on 02-16-2007
    • Posts 9

    Re: Dll / Class Access [C#]

    I'm not completly sure. Do classes have access to the datasources that the manifest document uses?
  • 02-20-2007 06:20 AM In reply to

    Re: Dll / Class Access [C#]

    Hi Biovox,

    We also have a Common class, which we are working up to release to the public before too long. Here's the steps we use:

    1. Add Common.cs to current InfoPath FormCode project.
    2. Change namespace in Common.cs to match that of the FormCode class
    3. Create a private global 'c' variable of Common type
    4. In OnLoad, call c.Init(x,y) where x is thisXDocument, and y is the string of all XML namespaces found in the form.
    5. When using common functions, call c.CommonFunction().

    Hope this helps!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 02-20-2007 06:25 AM In reply to

    • Biovox
    • Not Ranked
    • Joined on 02-16-2007
    • Posts 9

    Re: Dll / Class Access [C#]

    Where are you getting the thisXDocument from. It's not in my availble list of objects with my current name spaces. Also - I am using web only enabled features.
  • 02-20-2007 10:13 AM In reply to

    Re: Dll / Class Access [C#]

    Are you using the InfoPath 2007 or InfoPath 2003 object model? If you are using managed code in IP03, you should be very familiar with thisXDocument... therefore I'm assuming you are using IP07.
  • 02-20-2007 10:14 AM In reply to

    • Biovox
    • Not Ranked
    • Joined on 02-16-2007
    • Posts 9

    Re: Dll / Class Access [C#]

    2007
  • 02-21-2007 01:55 PM In reply to

    Re: Dll / Class Access [C#]

    IP2007 uses "MainDataSource" instead of "thisXDocument"... You will need to pass in that.
Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.