Re: puting an ocx in vb form
Hi oakwv and welcome to VBForums! :wave:
In order to use ocx in VB - control must be properly installed on the developer's machine including lisense for developer (quite often we may have some ocx on the system but we cannot use it).
Assuming you have it installed then you may create a brand new instance of that control by adding it to controls collection at run time:
(on the form only)
Dim ctl As Control
Set ctl = Controls.Add("VB.Textbox", "txtNew")
where VB.Textbox is ocx's ProgID and txtNew is its name.
Also, since (in my sample) Textbox is an intrinsic control you don't have to add lisense to lisenses collection or it is mandatory otherwise.
Unlike web apps VB requires ALL runtime files to be installed (and for that purpose we build distribution packages) so your chances to distribute your app without any ocx utilized in the project and expect it (your app) to function are close to ZERO - error such "ActiveX component cannot create object ..." most likely to be raised ...
Re: puting an ocx in vb form
If you don't want to add it at runtime, you can add it to your components list, and add it at design time.
This, of course, is, as RhinoBull points out, contingent on the proper licensing being available.
Re: puting an ocx in vb form
hi,
first register that component by typing
regsvr32 "path"
e.g. regsvr32 "C:\Workspace\GridOCX\GridOCX.ocx"
at the command prompt where "path" represent the actual path for that .ocx file
then select it from project menu and add it to ur form