Link Custom Controls to infopath

V

virgul

Hi,

I have some problem to understand how to link me user control (ActiveX)
in infopath!

I have carefully read this and try to do the example:

http://blogs.msdn.com/infopath/archive/2005/04/15/408728.aspx

But I don't understand two things in the chapter:

Adding a .NET User Control to the InfoPath Controls Task Pane

How to create a good ICT file? And In which folder I have to put my DLL
file?

Now my ICT file is like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ict:control name="UserControl1"
xmlns:ict="http://schemas.microsoft.com/office/infopath/2003/ict"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xdSdl="http://schemas.microsoft.com/office/infopath/2003/xct">
<ict:designTimeProperties>
<ict:iconBitmap>...</ict:iconBitmap>
</ict:designTimeProperties>
<ict:deployment>
<ict:controlPackage classid="{CB5BDC81-93C1-11CF-8F20-00805F2CD064}"
cabFile="{CB5BDC81-93C1-11CF-8F20-00805F2CD064}.cab"/>
</ict:deployment>
<ict:shapes>
<!--default shape-->
</ict:shapes>
<ict:schemaEditing>
<ict:simple type="string"/>
</ict:schemaEditing>
<ict:view>
<ict:controlObject bindingProperty="Value" bindingType="text"/>
</ict:view>
</ict:control>

Thanks for your Help!

Thierry
 
M

Michal Semhric

Hello

There is one possibility how to solve Your problem:
1) Use: regasm <path to Your ll containing control> /codebase
2) Change ict file (In that case You don't need cab file):
<ict:controlPackage classid="{CB5BDC81-93C1-11CF-8F20-00805F2CD064}" />

P.S. Please note, that this approach will work only if You have possibility
to register Your control assembly.

regards
Michal
 
V

virgul

Hi,

First things thanks a lot for your answer!
P.S. Please note, that this approach will work only if You have possibility
to register Your control assembly.

How to do that? I have create my own user controll so I can do that???
What do you mean by "possibility"?

And:

When I do regasm in cmd: I have an alert that say I need to sign my
assembly! the error is in french!
But it's a things like that:

Warning from regAsm:
When an unsigned assembly is execute with /codebase, He can make
interference with other application installed on the same computer.
/codebase must uniquely use with signed assembly. Please affect to your
assembly a strong name and do this command one more time.
inscription of the types succeeded


Is this two point linked or not?


Thanks a lot

++

Thierry
 
M

Michal Semhric

Hello virgul

Prerequisites: MS InfoPath 2003 + SP1, Microsoft .NET 1.1, WinXP SP1 (it
should work on Win2K Pro with latest SP and patches too)

1) Create an ActiveX Control from Your user control (see
http://blogs.msdn.com/infopath/archive/2005/04/15/408728.aspx)
- You need to create GUID for Your control (so it will not mess with other)
- You need to sign an assembly (use sn -k YourKefile to generate and add it
into assemblyinfo file in case that You are using C#)
2) register Your control using: regasm YourControl.dll /codebase
3) make sure that in ICT file You will have something like:
..
..
<ict:control name="YourNamespace.YourControl"
..
..
<ict:controlPackage classid="{YourGUID}" />


I think that shoudl be enought for develpoment of ActiveX for InfoPath.
(as far as I know You can't just add .NET user control itselft to InfoPath)
Unfortunately, I have no sample available (only product code which I can't
share), but main focus is hidden in article and articles to it related.

I do believe that You'll find a solution for that great product as InfoPath
is ;-)

Good luck
Michal
 
V

virgul

Hi,

Thanks for your help but unfortunately that always don't work !

I have make all that you have said and make exactly the same project
that is given in the example of msdn infopath blog!
But when I try to put my control in infopath I have little red cross on
the corner like IE when he can't download a picture in a website!

Question:

Do I copy my dll in another place? Now it is where I have make the
regasm : C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 is it right?

For the GUID I have the same that is provided in the example can this
make a problem?

What I have do step by step:

sn -k UserControl1.snk (no error the key is create)

copy it in my project folder and modify this two lines in
AssemblyInfo.cs (because I work with C#):

[assembly: AssemblyKeyFile("..\\..\\UserControl1.snk")]
[assembly: AssemblyKeyName("UserControl1.snk")]

build the solution (no error) and copy the dll in
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 and make the regasm:

regasm UserControl1.dll /codebase (no error)

Modify my ICT:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ict:control name="WindowsControlLibrary1.UserControl1"
xmlns:ict="http://schemas.microsoft.com/office/infopath/2003/ict"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xdSdl="http://schemas.microsoft.com/office/infopath/2003/xct">
<ict:designTimeProperties>
<ict:iconBitmap>...</ict:iconBitmap>
</ict:designTimeProperties>
<ict:deployment>
<ict:controlPackage
classid="{CB5BDC81-93C1-11CF-8F20-00805F2CD064}"/>
</ict:deployment>
<ict:shapes>
<!--default shape-->
</ict:shapes>
<ict:schemaEditing>
<ict:simple type="string"/>
</ict:schemaEditing>
<ict:view>
<ict:controlObject bindingProperty="Value" bindingType="text"/>
</ict:view>
</ict:control>

And Launch Infopath!

Any Idea?

Thanks very much for your help!

++

Thierry
 
G

Gaurav Bhardwaj

Hi,

I am also facing the same problem. I followed the same steps mentioned in
the article but when i try to place the control, i get a cross on the top
left corner. Can anybody please help me out in creating and using custom
control ?

Regards,
Gaurav
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top