Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / December 2004

Tip: Looking for answers? Try searching our database.

Can't import .OCX assembly into Web Matrix Project.Hi,

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jason Robertson - 29 Nov 2004 10:28 GMT
Hi,

I am using Web Matrix Project as .NET programming environment. Can you show
me detailed steps how to import the .ocx  library into the Web Matrix
Project. I can't seem to be able to import other assembly than .dll, .exe or
.mcl . I am pretty new to the .NET programming environment, and may be
missing something.

I can see the file in C:\Program Files\Common Files\Tops\xyzxyz.ocx , but I
can't find a way to import it into the Web Matrix Project to see all Methods
and Properties of the assembly.

Thank you for any help.
Shanku Niyogi (MS) - 17 Dec 2004 15:59 GMT
You can import an .OCX into your ASP.NET project, and use it as a component,
by first wrapping it in a .NET interop assembly. However, if you have a
visual .OCX (a control you can use on a VB form), you cannot use it visually
in an ASP.NET page.

To use an .OCX component in your project, use the following steps:

1) Install the .NET Framework SDK, if you haven't already.
2) Open a Windows command prompt, and go into the directory where the OCX is
stored.
3) Run the following command line:

"c:\program files\microsoft.net\sdk\v1.1\bin\tlbimp.exe" ocxname.ocx

where ocxname.ocx is the name of the OCX. Note: If your SDK was installed
somewhere other than above, you'll need to change the path to the tlbimp.exe.
4) The tlbimp tool will inspect the OCX, and create an interop assembly for
it. Note the file it creates. This name is generated from the name of the
OCX's type library, and can be customized using a command line option for
tlbimp.
5) Go back into Web Matrix, and import the interop assembly into your project.
6) ASP.NET pages need to be in ASPCompat mode to use most OCXs,  because
these components are not free threaded. Go into your page, and add an
attribute to the <%@ Page > directive at the top, like this:

<%@ Page AspCompat="true" %>

That's it - you should now be able to use this OCX on your page. You can't
drag and drop it onto the page, because it's not a web control, but you can
programmatically create one of these objects in your page code, such as in
Page_Load.

Thanks,
Shanku

> Hi,
>
[quoted text clipped - 9 lines]
>
> Thank you for any help.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.