Using a VB6 ocx in C# .net

O

omar.torres

Hi all,

Currently I have a VB6 application which uses a custom OCX. To use the
ocx in my VB6 application, I used the following code:

Public MyOCXInstance As OCXobject 'Create a new instance of the OCX
.....
Function read()
Dim MyString as string
MyOCXInstance.read(MyString)
.....'Validate MyString
read=MyString
end Function
....

Function write(byVal S as string)
write = MyOCXInstance.write(S)
end Function



Now I will like to create a C# app base on the same OCX. How can I do
this?
I am new to the C# language so the more details the better! :)
Just in case, I am using .Net 2005.

Thanks in advance for your help,
-Omar
 
N

Nicholas Paldino [.NET/C# MVP]

Omar,

You should go to your toolbox and select "add new item". A dialog will
come up. If the control is registered on your system, then you can select
the "COM" tab on the dialog that comes up, and add a check to your control.
Once you do that, it will be in your toolbox, and you can just use it at
that point in your apps.

Hope this helps.
 

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

Top