-
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
-
I recently had the same question:
http://forums.vb-world.net/showthrea...threadid=28316
and dont forget to add the ocx to your program
-
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