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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with a custom control 2

Status
Not open for further replies.

kg9ie

Technical User
Jun 3, 2000
18
0
0
US
I'm creating a custom control that is actually a combination of a treeview control and a couple other controls. I am going to load the treeview control from records in a database, but I need to filter the records based on an employee ID in a textbox on the form that loaded the form containing my custom control.

How do I pass this data to my control? Then, I need to load the checked nodes into a global array. Is all of this possible?

BTW, this control is its own project in a project group. The form that the control is being placed on is in another project in the group.

Thanks for any help,
Todd
 
Everything is possible.You have to set properties for your Custom Control to pass the ID from the container form and another propery to pass the results back.

You should keep the Custom control as a project only untill you finish debugging it and making changes in it. Then you compile it as an ocx that's included as a component (Project|Components Menu)
Hope that helps.
 
I will suggest, first to add the control to the same project. THen you have references of the DB Libraries you aree using in the control. Create a property for the control of type string. Pass the SQL to load the data viia this property. In the usercontrol's ReadProperties Event, load the Treeview with this SQL. Simple.. If you want this propeerty to be writeable in run mode, the best thing is to place the code in a method, and call the method from the Forms' Load event.

See this

This is the USer Controls' Code

Public Function LoadDataToTreeview(StrSQL as string) as boolean


''''Load The tv heere....
LoadDataToTreeview=success
End Function

This is the Form in whcih the Ctrl is placed

Form_Load Event

bln=MyCtrlTV.LoadDataToTreeview("Select EmpName from Employee")


All the best All the Best
Praveen Menon
pcmin@rediffmail.com
 
Thanks for the help. It's quite easy once you know how!

~Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top