How to map Datasource property?
There's a listbox in my control, and I want to map it's datasource to my control,How can I do that?
And what's DataSource's type? Active Control Interface Wizard declear it as DataSourse e.g:
Public Property Get DataSource() As Recordset
but an error will occur and prompt that DataSourse is an undefined type.
Re: How to map Datasource property?
Quote:
Originally Posted by Arc
OK i figured it out:D It's a little complex so stay with me:D
1) CHange the Usercontrols DataBindingBehavior to vbSimpleBound in the propertys window.
2)Make sure your cursor is in the code window for your usercontrol, preferably in one of the Property procedures of the property you wish to reflect the bound data.
3) Choose the Tools, Procedure Attributes option form the VB menu.
4) On the resulting dialog box, make sure the property that will reflect the bound data is chosen in the names field.
5) CLick the Advanced button
6) in the databinding section at the bottom of the dialog, check the box labeled "Property is databound", and then chekc the box labeled "This property binds to datafield"
That should create the Dtabound and datasource propertys you need:D
I have a question about this. I have several controls that I created myself which use this method of databinding. It works wonderfully in design-time. However, when I try to assign the DataSource property of my control in run-time (w/code) I get "Method or Data Member not found." Why is this?? Is there a solution? You seem to be the most knowledgable person I have seen around yet. please, help. ;(