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:
Code:
ComboBox cmb = new ComboBox();
cmb.DisplayMember = "desc";
cmb.ValueMember = "id";
cmb.DataSource = dt;
The VB equivalent is:
Code:
Dim cmb as 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.
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#)
Code:
IntPtr p = ComboBox.Handle;
The result is ALWAYS a ComboBox with ZERO Items.

Any help is appreciated.

Thanks,
Xmas.