Answered by:
How to do ActiveX Control?

Question
-
Hi,
I'm using Visual Studio Standard 2008.
Is it possible for Visual Basic to work on ActiveX Control? Is it in Professional Edition?
Or have to use C++ for MFC ActiveX Control?
Thanks,
ElvinThursday, June 26, 2008 5:24 AM
Answers
-
Hi Elvin,
You can create ActiveX Control in Visual Studio Standard 2008 by means of project template: "Windows Forms Control Library" or "Class Library", and you need to expose an interface to the COM world.
http://www.vbdotnetheaven.com/UploadFile/dsandor/ActiveXControlInVBdotNET04112005081747AM/ActiveXControlInVBdotNET.aspx
If you use "Class Library" project template to create a project, then delete the Class1.vb file. Next, add a "User Control" to the project by right clicking on the project in Solution Explorer, choose Add -> User Control.
Here are several examples:
1. Writing an ActiveX Control in VB.NET
2. Exposing Windows Forms Controls as ActiveX controls
http://www.codeproject.com/KB/miscctrl/exposingdotnetcontrols.aspx
3. Writing an ActiveX Control in C#
http://www.c-sharpcorner.com/UploadFile/dsandor/ActiveXInNet11102005040748AM/ActiveXInNet.aspx?ArticleID=99d9681d-84de-4d64-9c85-9ae9c15a4ee7
Reference: About “Register for COM Interop” option in the Compile tab
http://forums.msdn.microsoft.com/en-US/vbide/thread/1e5b52ac-a9ab-4a04-b356-8ac1da049704
Best regards,
Martin Xie- Marked as answer by Martin Xie - MSFT Wednesday, July 2, 2008 11:47 AM
Wednesday, July 2, 2008 11:46 AM
All replies
-
I'm using Visual Studio Professional so I can say that this will work for sure in the "Standard" edition, but I don't see any reason why it shouldn't.
With your VB project open, do the following:
1. Click "Project" on the menu bar.
2. Select "Add Reference".
3. Click the "COM" tab or use the "Browse" tab if it's not in the list of components.
4. Locate and select the component your looking for.
5. Click "OK" to add it to your project.Thursday, June 26, 2008 12:15 PM -
Hi,
Thanks for the reply, that is on how to include an ActiveX I believe?
What I'm looking for is how to work on an ActiveX, like create, program one..
I believe there is an template for VB to create one... just like C++ 's MFC ActiveX.
Any help?
Thanks,
ElvinFriday, June 27, 2008 3:04 AM -
Hi,
I'm still looking for answers.
From what I've researched, there are supposed to have ActiveX Control template project for VB.
But I do not see them in Standard Edition. Are they are in Professional Edition? Cause if so, then I would need to ask my Boss to buy it.
Thanks,
ElvinTuesday, July 1, 2008 3:37 AM -
Hi Elvin,
You can create ActiveX Control in Visual Studio Standard 2008 by means of project template: "Windows Forms Control Library" or "Class Library", and you need to expose an interface to the COM world.
http://www.vbdotnetheaven.com/UploadFile/dsandor/ActiveXControlInVBdotNET04112005081747AM/ActiveXControlInVBdotNET.aspx
If you use "Class Library" project template to create a project, then delete the Class1.vb file. Next, add a "User Control" to the project by right clicking on the project in Solution Explorer, choose Add -> User Control.
Here are several examples:
1. Writing an ActiveX Control in VB.NET
2. Exposing Windows Forms Controls as ActiveX controls
http://www.codeproject.com/KB/miscctrl/exposingdotnetcontrols.aspx
3. Writing an ActiveX Control in C#
http://www.c-sharpcorner.com/UploadFile/dsandor/ActiveXInNet11102005040748AM/ActiveXInNet.aspx?ArticleID=99d9681d-84de-4d64-9c85-9ae9c15a4ee7
Reference: About “Register for COM Interop” option in the Compile tab
http://forums.msdn.microsoft.com/en-US/vbide/thread/1e5b52ac-a9ab-4a04-b356-8ac1da049704
Best regards,
Martin Xie- Marked as answer by Martin Xie - MSFT Wednesday, July 2, 2008 11:47 AM
Wednesday, July 2, 2008 11:46 AM -
Hi Martin,
Great post. Thanks. Exactly what I am looking for.
Thanks,
ElvinFriday, July 4, 2008 2:07 AM