ActiveX vs. UserControl vs. DLL?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 9 of 9

Thread: ActiveX vs. UserControl vs. DLL?

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    ActiveX vs. UserControl vs. DLL?

    [Originally posted by xterra210]

    I'd like to make an ACTIVEX, which im guessing are the controls you see at the top of VB (Timers, COmmands).

    However, Im stuck.˙ On a tutorial, it said to start, click on UserControl.˙ This tutorial just tought me how to make a usercontrol.˙ I want to make an actual ActiveX (and be able to load it from Components section).

    Could someone help me distinguish between ActiveX and Usercontrol?

    Thankyou

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:ActiveX vs. UserControl vs. DLL?

    [Originally posted by Greg DeBacker]

    It sounds like you want to make an OCX that can be loaded into VB and then can be drawn on a Form by a user. To do this start a new project and select ActiveX Control. You will˙ Create 'Project1'. Project1 will contain 1 UserControl called 'UserControl1'. When you compile this it will have an OCX extention. After you register the compiled OCX with Windows your User Control will show up in the Components dialog.

    It is easier to create a Project Group with both a your ActiveX Control and a standard VB project you can use as a test container for your control while you are creating it.

    Grex

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:ActiveX vs. UserControl vs. DLL?

    [Originally posted by xterra210]

    Thanks for the reply...let me see if i get this:

    To make it have the OCX extention, I click on ActiveX.˙ BUT, then I will Load a usercontrol TO the activex document by right clicking and pressing "Add Control".˙ Is this right?

    I guess I should have been pressing ActiveX, instead of UserControl

    Thanks again.


  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:A oh wait

    [Originally posted by xterra210]

    I get it now.˙ See when I replied I wasnt on my computer so I was a little slow:)

    Thanks

  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:ActiveX vs. UserControl vs. DLL?

    [Originally posted by John Citizen]

    Close to the mark.

    A UserControl to an ActiveX.ocx is like what a Project.vpp is to a MyProgram.exe.

    Have you ever had two projects open in the same vb program? This is often referred to as a Project group and is saved as a .vpg file.

    You can do this by openning one project and then adding another project to it. (This is NOT the same as opening two projects in two different windows).

    User controls (which can be compiled to .ocx files) can not run by themselves, they have to be on a project. So for debugging purposes when making a user controls it is avised to have two projects open at once in THE SAME VB program. One is a normal project and the other is your user control. This allows you to drop your control onto a form of your project. (This is what grex is saying)

    When you are happy with your user control you can compile it into a .ocx file and use it in your other projects (like you use the command button and timers etc...)

    One last thing.. What is the difference between a .dll and .ocx?

    They can both can be compiled and added to your projects later. The .dll is added via the Refrences menu under Project menu. The main difference is a .dll works more like a class module and an .ocx (or user control) works more like a form.

    John Citizen
    Neocom IT

  6. #6
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Re:ActiveX vs. UserControl vs. DLL?

    [Originally posted by xterra210]

    Cool.˙ Thanks for all the replies.˙ ActiveX programming is what Im intereste in.˙ When I usually make normal programs I spend to much timer on the user interface and it takes to much time, ActiveX I don't have to worry about...
    While searching for componentsource.com, I thought It would be interesting to shorten make a control for all programmers to use that have many functions (getuserinformation,getoperatingsystem) all in one control.

    This is my first control, and I appreciate all posts here.

    Thanks again:)

    -xterra210@hotmail.com

  7. #7
    Join Date
    Aug 2004
    Posts
    43,023

    sorry for double post: my function code:

    [Originally posted by xterra210]

    Hi all.˙ This is my usercontrol code.˙ I have received an error. Ill show it to you in a minute:
    This code will give you the operating system.˙ Version is the string, and will hold the os name

    Dim version As String

    Public Property Get getSYSTEMVERSION() As Long

    ˙ ˙ Dim thestuff As OSVERSIONINFO
    ˙

    ˙ ˙ Select Case thestuff .dwPlatformId
    ˙ ˙ ˙ ˙ Case 0
    ˙ version = "Windows 32s "
    ˙ ˙ ˙ ˙ Case 1
    ˙ ˙ version = "Windows 95 "
    ˙ ˙ ˙ ˙ Case 2
    ˙ version = "Windows NT "
    ˙ ˙ Case 3
    version = "XP"
    ˙ ˙ End Select
    ˙ ˙
    End Property


    MODULE:


    Type OSVERSIONINFO

    ˙
    ˙ ˙ dwPlatformId As Long

    End Type





    I also have a module.˙ The module is not the problem, however, I started a new project, added the user control (named TEST), and tested it.˙ After receiveing the error, I thought, well, I better add the module also.˙ Well, it worked.˙ I came to the conclusion that the module MUST be present when using the control.˙ When I am ready to compile the user control, I am guessing the computer will also combine the module with the control?

    Thanks.



  8. #8
    Join Date
    Aug 2004
    Posts
    43,023

    re: YEAH, ITS WEIRDER

    [Originally posted by xterra210]

    im reaalllyyy sorry here.˙ just forget everything and look at this;)

    This command has simple GETFULLDATE function

    it will give you the value of TIME & DATE & YEAR(DATE)
    Public YEARNOW as variant
    PUBLIC fulldate as variant
    SO FAR:
    Public Property Get getYEAR()
    yearnow = Year(Date)
    End Property
    Public Property Get getFULLDATE()
    fulldate = Time & " " & Date & " " & Year(Date)
    End Property


    Get this!˙ It's weird:˙ When I use it, I get a˙ null value.˙ PLUS, yes, it gets weirder.˙ I play around with it:

    mycontrolname.getFULLDATE '//looks good, right?
    '//well look at this:

    mycontrolname.fulldatenow

    What it is doing is grabbing the public variable, and placing it with my control actions.˙ For example, I just want it to show getFULLDATE, but, with this, it also is displaying the Public VARIANT with the actions of MyControlName..


    This will be my last post:)

  9. #9
    Join Date
    Aug 2004
    Posts
    43,023

    yeah I fixed it;)

    [Originally posted by xterra210]

    wouldnt you know it, I fixed it.

    The little voice in my head said:

    change the varible to Private.

    :)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center