|
-
Apr 29th, 2002, 09:30 AM
#1
Thread Starter
Lively Member
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.
-
Apr 29th, 2002, 05:24 PM
#2
Try:
Public Property Get DataSource() As Variant
Internally treat DataSource as a datatype of Object or RecordSet
The client can pass anything as a Variant.
-
Apr 29th, 2002, 08:05 PM
#3
-
Apr 29th, 2002, 08:17 PM
#4
PowerPoster
-
Apr 30th, 2002, 11:36 AM
#5
Thread Starter
Lively Member
I did it as you said and I can select DataSource and DataField in the properties window now.But it prompt that "Unable to bind to field:CompanyName".Why?
(I used Nwind.mdb)
-
Apr 30th, 2002, 12:21 PM
#6
PowerPoster
Well, did you conect it to a data control? in order to use the databinding cappabilities you have to be bound to a data control.
I tried it and got no errors.
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
May 6th, 2002, 10:05 AM
#7
Thread Starter
Lively Member
Would you please send me your sample project?
My e-Mail adress:
[email protected]
or [email protected]
-
Jul 24th, 2005, 04:33 PM
#8
New Member
Re: How to map Datasource property?
 Originally Posted by Arc
OK i figured it out  It's a little complex so stay with me
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 
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. ;(
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|