 |
|
|
 |
|
 |
Hi all,
maybe others are botherd by the same Problem I had.
Problem:
Using Visual Studio 2010 and the InteropFormToolkit 2.1. I loaded and set up the files as described in this Tutorial. But when I clicked "Tools --> Build wrapper..." the Wrapper Class is still VB.Net Code which, of course, causes errors building the project. In addition I noticed that under "Tools-->AddIn MAnager" the new AddIn is not listed, only the original AddIn from the Toolkit.
Here is the solution that worked for me:
First of all, open the source code off this AddIn in Visual Studio 2010. Admit the Messages to convert the project to Visual Studio 2010 and then rebuild the whole Project. Doing so you get a new file "InteropFormAddIn.AddIn" and "InteropFormAddIn.dll". Now copy these to files in your AddIn Folder.
Now open the file "InteropFormAddIn.AddIn" in VS 2010, because it is an normal xml-file. In the first section add the following
<HostApplication>
<Name>Microsoft Visual Studio Macros</Name>
<Version>10.0</Version>
</HostApplication>
<HostApplication>
<Name>Microsoft Visual Studio</Name>
<Version>10.0</Version>
</HostApplication>
and at the end of the file change the numbers 5,1,1 to 1,1,0 - so it looks like this:
<LoadBehavior>1</LoadBehavior>
<CommandPreload>1</CommandPreload>
<CommandLineSafe>0</CommandLineSafe>
Now close and reopen Visual Studio. Under Tools you now should see the new AddIn "Build C# Wrapper..." with a smiley in front of it.
|
|
|
|
 |
|
 |
Hi,
I tried to use you addInn following what you wrote in you paper but when I try to generate the wrapper an error like this is displayed: "Unable to generate wrapper class since no interopforms were found". It seems that the Microsoft AddIn is running but I copied it in addin folder and I changed the xml file.
Some suggestions?
Thans in advance Giampaolo
|
|
|
|
 |
|
 |
I hope you could help me with this.
It’s using c# as interop in Vb6.
The guy who did this left the job so didn't leave me with enough knoweladge.
What I'm wondering I have control on my machine working correctly in VB6.
Lets say we call this control in c# InteropUserControl1
now what I do once I get tlb file for my project I register it with reasm /codebase into tlb file
Now the bit that's puzzling is how is this thing added to VB6. I can add ref to tlb file but application fails on fresh machine. I need to make it as Ctl so that it would work. What do I need to do so I can add it as control. It doesn;t like appending tlb or dll files as controls? There must be a thing or tweak that allows it to be added as Ctl to the VB6 forms.
It doesn’t fail once it’s control.
Any help would be greatly appreciated.
|
|
|
|
 |
|
 |
I revisited this in a break between our projects and found that i could not load the Add-In directly into VS2010. Opening the source in Vs2010 runs the converter which errors on the form for testing the Add-In but imports the actual Add-In code no problem. I then re-compiled targetting the .NET 4 framework and it now seems to load no problem and does not error on http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=3109091[^] test project so i assume it is now working!!
There is also an updated toolkit for 2008/2010 which saves fiddling with the XML for the Add-In (see my comment below in 'does it work in VS2008'?).
|
|
|
|
 |
|
 |
Everything works great for creating user controls in C# and using them in my VB6 app, except that I am unable to implement drop-down functionality in a control.
I tried creating a form in C#, but I get an error 'No interop form found' when I try to generate the wrapper. I tried translating the wrapper class from one generated from a VB.NET form, but no joy so far (the wrapper class compiles, but nothing appears in VB6).
If I manually create the wrapper class, do I need to REGASM it? Is there something else I'm missing?
TIA.
|
|
|
|
 |
|
 |
Just wondering if it works on vs2008
Anybody?
any experience?
thanks a lot
|
|
|
|
 |
|
 |
It works
|
|
|
|
 |
|
 |
It will ONLY work if you edit the AddIn file directly (the InteropForm.AddIn file you put in the AddIns directory) and replace the Version tag to "*" (implying any version of Visual Studio can load the Add-In):
Original excerpt:
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<Extensibility xmlns="http://schemas.microsoft.com/AutomationExtensibility">
<HostApplication>
<Name>Microsoft Visual Studio Macros</Name>
<Version>8.0</Version>
</HostApplication>
<HostApplication>
<Name>Microsoft Visual Studio</Name>
<Version>8.0</Version>
</HostApplication>
Change to:
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<Extensibility xmlns="http://schemas.microsoft.com/AutomationExtensibility">
<HostApplication>
<Name>Microsoft Visual Studio Macros</Name>
<Version>*</Version>
</HostApplication>
<HostApplication>
<Name>Microsoft Visual Studio</Name>
<Version>*</Version>
</HostApplication>
it took me all day to work this out....
|
|
|
|
 |
|
|
 |
|
 |
when i recompile and drop the new files in the addins folder vs 2k5 tells me there's something wrong with 'em. what gives? anyone have a compiled version-free set of files they want to post?
modified on Wednesday, June 8, 2011 9:14 AM
|
|
|
|
 |
|
 |
I copied the addin and the DLL to the 2008 add in folder..but it seems to still only create a wrapper in VB code and not C# code. What could I be doing wrong.
|
|
|
|
 |
|
 |
I was using the VB addin, but still get error when trying to load this add in in VS 2008
|
|
|
|
 |
|
 |
Hi there,
Was wondering if you can help me. If i create a Forms folder in my .net project and place my interop forms within this new folder when i go to generate my wrapper class i get an error. But if i move the interop forms out of the Forms folder and into the base directory it works fine.
Please help if you can as i wont to place all my forms into a forms folder for a large scale hybrid vb6 and .net application.
Thanks
|
|
|
|
 |
|
 |
Is it a Interop UserControl version?
|
|
|
|
 |
|
 |
When I first installed this, everything seemed to work just fine. However, I completely deleted my first project, and for the second, the InteropFormWrapper C# Class Generator is creating VB code in the *Form.wrapper.cs file. I really don't know what is going on here but if someone can post or email me a copy of the real cs wrapper, I can just copy/paste that into my app and I think that it would be okay.
-John
|
|
|
|
 |
|
 |
Well, I just tried translating it myself and (much to my surprise), it worked. I would like to know what i am doing wrong anyway. Thanks for a very useful tool. -John
|
|
|
|
 |
|
 |
I am having issues with the Add in when it is loading. I am getting an error, not sure why, but I did come across something that may help you. Under tools click on the addin manager. Check the C# interopForm wrapper and that it is also checked for startup.
|
|
|
|
 |
|
 |
Can someone please demostrate or supply sample code on how to expose custom properties and methods to the host application using the InteropFormProperty and InteropFormMethod attributes.
Thanks.
|
|
|
|
 |
|
 |
I found a good code example on how to do this at: http://www.codeproject.com/useritems/VB6InteropToolkit2.asp in the CSMultithreadedControl sample project.
Edward Lane
|
|
|
|
 |
|
 |
Also in this solution there is no use of custom properties. Custom properties doesn't work....
|
|
|
|
 |
|
 |
Hi all! This message is very old but topic is still very accurate...I've been looking around for several hours trying to expose C# custom events and properties to my VB6 app and I finally got it to work so I thought it is worth sharing so hopefully it'll save you time.
Example to add a RecordSaved event:
Perform the following steps within your c# usercontrol class,
---------------------------
Step 1 - Create your event
---------------------------
<pre lang="cs">[InteropFormEvent()]
public event RecordSavedEventHandler RecordSaved;
public delegate void RecordSavedEventHandler(object sender, System.EventArgs e);</pre>
Step 2 - Assuming you have a button on your usercontrol UI, put this in the Click event:
-----------------------------------------------------------------------------------------
<pre lang="cs">private void Button1_Click(object sender, EventArgs e)
{
if (null != this.RecordSaved)
this.RecordSaved(sender, e));
}</pre>
Step 3 - Make your event visible to COM
---------------------------------------
Add this :
<pre lang="cs">[DispId(3)]
void RecordSaved(object sender, System.EventArgs e)</pre>
to this block:
<pre lang="cs">public interface __usercontrolnamehere
{
[DispId(1)]
void Click();
[DispId(2)]
void DblClick();
//add additional events visible in VB6
}</pre>
That's it!
MORE
-----
To expose custom properties, you create your property as you normally would and then add a reference to it under this line (7 being the next logical number based on previous DispId values in the same block):
<pre lang="cs">//add additional properties visible in VB6</pre>
<pre lang="cs">[DispId(7)]
int myPropertyName { [DispId(7)] get; [DispId(7)] set; }</pre>
And voilà! Have fun! :)
|
|
|
|
 |
|
 |
I copied the 'InteropfromAddin.Addin' from binary, at "My Documents\Visual Studio 2005\Addins". When i restart the VS2005 designer it gives me following error - "The Addin in 'InteropForm Wrapper c# Class generator' failed to load or caused an exception. Would you like to remove this Add-in ?".
Amit
|
|
|
|
 |
|
 |
I am getting same error, did you ever get this fixed or find out why?
|
|
|
|
 |
|
 |
just in case someone else has the same problem. There is a .dll included in the project. I moved that .dll to the same folder as the addin. That fixed the error
|
|
|
|
 |