Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to add source code??

Status
Not open for further replies.

LordDuzy

Programmer
Feb 12, 2004
22
PL
I've created a control while the program is working:

Set lblTree = Main.Controls.Add("VB.Image", "Tree")

With lblTree

.Width = 700
.Visible = True
.Height = 700
.ToolTipText = "HI"

.Top = 500
.Left = 500

End With

And how to add source code to the created control??
(Private Sub Tree_Click() )
help me plz
thx in advance
 
If i understood well u created an activex control and you're using it on another form! now u want that the tree shows the event Click() on the form!

To do so you need to create an event on the UserControl using:

Public Event Click()

Then double click the tree on the user control and on the click event use

Raise Event Click()

Than enter the code you need in the form!

Hope i made myself clear!

Nick
 
I want to create more objects like theese.
And it's not so easy to write source code for every one before lunching the project. how to build a function that creates sub functions????????
 
You can use the Tag property to store an id for each control. Or can make the control the first element of an array and use the index of the array to check for each instance and then execute a code block based on the index.

------------------------------------------
The faulty interface lies between the chair and the keyboard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top