UserControl newbie question...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I am creating my first UserControl. I want to add properties (not only other controls) that I can bind later
I am adding properties like this

public property TestProperty() as strin
ge
...
se
...

When I use the control in a Form, I can't find the "DataBindings" property to add to.
(i.e. myControl.TestProperty.DataBindings.Add

TIA

Mike
 
what do you want to do?

myControl.TestProperty is a string and DataBindings is not a member of the
string class...

can you give some more info?


Mike said:
Hi,

I am creating my first UserControl. I want to add properties (not only
other controls) that I can bind later.
 
Dominique and Ken, thanks for the responses. I wasn't finding the correct DataBindings :)...

It should be like this: MyUserControl.DataBindings.Add(...

Ken, not all properties are bindable?? What I want to do is more complex...
I want to use an ArrayList inside the UserControl and bind to a variable length of items
with the same type. Something like this:

--------
Public class MyUserControl
.....
Public MyItems as ArrayList

Public sub BindToMyItems(byref TheItems as ArrayList)
me.MyItems = TheItems

for each item in MyItems
me.DataBindings.Add("I dont know how to specify an MyItems(0).Object.Property in my ArrayList"....
next

end sub

-------

As you see, I can't figure out how to specify a binding for an object in an ArrayList. I know that I can
reference the item with CType(MyArrayList(0), MyObject).Value, but I can't figure how to do it in the
DataBindings.Add("..."

I know I am a dumb newbie...

Thanks for the help!!

Mike.
 
Hi,

Yes they are. I thought you were trying to get it show up under
databinding in the controls property window.

Ken
 
Back
Top