Results 1 to 4 of 4

Thread: puting an ocx in vb form

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    1

    puting an ocx in vb form

    I am new to vb but have written a web server in other language. I used an web server ocx to get the request and send response to the browsers accessing the site. I have tried to put the ocx in a visual basic form but cannot. How do I use it in my VB code? OR an easier way to make my application know what is being requested by browsers and send reposnse? just need to get started. Thanks in advanve OAk

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: puting an ocx in vb form

    Hi oakwv and welcome to VBForums!

    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 ...
    Last edited by RhinoBull; May 22nd, 2005 at 07:57 PM.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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.

  4. #4
    New Member
    Join Date
    Jun 2005
    Posts
    8

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width