Hi all,
I have a DataTable (named dt) with data inside. I need to create a runtime CheckBox and assign that DataTable as ComboBox.DataSource. Here's some C# code:
The VB equivalent is:Code:ComboBox cmb = new ComboBox(); cmb.DisplayMember = "desc"; cmb.ValueMember = "id"; cmb.DataSource = dt;
With ComboBox drawn at design time (and without creating a new one) the code works fine. But if I don't use a design time ComboBox and create a new one from scratch (like the code above) doesn't work.Code:Dim cmb as New ComboBox() cmb.DisplayMember = "desc" cmb.ValueMember = "id" cmb.DataSource = dt
I also tried to force the creation of the control by calling the .CreateControl() method or forcing the creation of the handle by getting it with (C#)The result is ALWAYS a ComboBox with ZERO Items.Code:IntPtr p = ComboBox.Handle;
Any help is appreciated.
Thanks,
Xmas.


Reply With Quote