Results 1 to 3 of 3

Thread: OCX developement question..

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Okay, here's a simple one for you professionals out there..

    I'm learning how to create ocx controls and I need to learn a simple procedure.

    I have a program named Program.exe. It consists of a form named Form1 with the following controls:

    Command1 (button)
    Text1 (button)

    I also have an ocx control named Program.ocx.

    It has a public function named HelloWorld.

    What I want to be able to do is to hit the button and call the ocx which will in turn populate the text box with "Hello World!".

    What would I put in the HelloWorld function in the ocx control in order to fill the text box with "Hello World!" from the calling program?

    I tried:

    Text1 = "Hello World!"

    But that doesn't seem to do anything...

    I understand how to call the function from within the program, I just don't know how to get the ocx function to fill the text box..

    Any help would be appreciated..

    Dan




  2. #2
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    I recently had the same question:

    http://forums.vb-world.net/showthrea...threadid=28316

    and dont forget to add the ocx to your program
    NXSupport - Your one-stop source for computer help

  3. #3
    Guest
    Just pass the TextBox through the sub.

    Code for a UserControl
    Code:
    Public Sub HelloWorld(obj As Object)
        If TypeOf obj Is TextBox Then obj.Text = "Hello Wordl"
    End Sub
    Code for a Form.
    Code:
    Private Sub Command1_Click()
        MyControl1.HelloWorld Text1
    End Sub

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