I have a main class which creates and populates a DataSet and an instance of this class is then passed to sub controls of my application by reference. I want to use this dataset to databind to components, in this case, a listbox. This is for a windows forms application.
Heres what I'm trying:
channelTypesLB.DataBindings.Add("Text", synData.ds, "ChannelTypes.channelType");
Note, I've also tried this: (not sure if theres a difference)
channelTypesLB.DataBindings.Add("Text", synData.ds.Tables["ChannelTypes"], "channelType");
Theres no errors and I do not see the data in the listbox... when I output synData.ds.Tables["ChannelTypes"].Rows.Count
it tells me that there is in fact data in this datatable.
Am I missing something? I also trued channelTypesLB.Refresh(); after setting the databinding.
This may also be helpful... this is the code in my main class where the dataset is created, not sure if its maybe a scope issue, I'd imagine I would have received an error:
private DataSet _ds = new DataSet();
public DataSet ds { get { return _ds; } }