How to insert a .NET control in VB?
Problem:
You are working for a legacy product in VB. You are asked to build a new component as a control. Since .NET is a great way to develop controls you build the control in .NET. But now how to add the new control in the VB form?
Solution:
1. Create ur control in .NET.
2. Make sure in your Config properties "Register for COM Interop" is set to true.
3. After the buils is successful register the library using
regasm YourDll.dll /tlb:YourDll.tlb
4. Add the tlb as reference in VB.
5. Create a custom User Control in VB.
6. Use CreateObject to load the control.
Note:
If CreateObject loads but does not display your control use a shim control provided by Microsoft to load the control.
More at http://msdn.microsoft.com/vstudio/downloads/samples/automation.aspx
This control was developed for Automation, but currently this is the only way to use a .NET control as an ActiveX.
Warning:
Microsoft doesn't support this kind of deployment. Infact this support was removed in .NET
http://discuss.develop.com/archives/wa.exe?A2=ind0107b&L=dotnet&F=&S=&P=16992
The above solution is a wok around that you can use.
You are working for a legacy product in VB. You are asked to build a new component as a control. Since .NET is a great way to develop controls you build the control in .NET. But now how to add the new control in the VB form?
Solution:
1. Create ur control in .NET.
2. Make sure in your Config properties "Register for COM Interop" is set to true.
3. After the buils is successful register the library using
regasm YourDll.dll /tlb:YourDll.tlb
4. Add the tlb as reference in VB.
5. Create a custom User Control in VB.
6. Use CreateObject to load the control.
Note:
If CreateObject loads but does not display your control use a shim control provided by Microsoft to load the control.
More at http://msdn.microsoft.com/vstudio/downloads/samples/automation.aspx
This control was developed for Automation, but currently this is the only way to use a .NET control as an ActiveX.
Warning:
Microsoft doesn't support this kind of deployment. Infact this support was removed in .NET
http://discuss.develop.com/archives/wa.exe?A2=ind0107b&L=dotnet&F=&S=&P=16992
The above solution is a wok around that you can use.
© Copyright 2006. Bipin C Nair. All rights reserved.
0 Comments:
Post a Comment
<< Home