design time DataSource in VB

S

Stephen

IN VB.NET
I have a form with a ListBox and would like to set the DataSource property
at design-time but I can't seem to declare any kind of variable that will
show up in the list. I have tried a traditional array, ArrayList,
Collection as public vars in the Form Class's Declarations section. Setting
the DataSource property to any of these works fine at run time.

I want to do it at design time because after I change the Collection, it
doesn't update it in the ListBox, even though breaking showed that the
Collection.Count property had gone up. I first add to it in code with
Coll.Add("WHATEVER") and it shows up fine, before and after binding. But I
try
to do this: Coll.Add(TextBox1.Text) and it doesn't show up in the ListBox
but is apparently being added to the collection object just fine.

Any answer to either of these questions would be helpful
Thanks,
Stephen
 
K

Karen Martinez

Have you tried resetting the ListBox's DataSource after adding your item to
the collection?

Me.ListBox1.DataSource = mMyCollection

I have something similar where my collection object raises a List_Changed
event, and I respond by resetting the DataSource of the ListBox.

Karen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top