ComboBox container
-
I declare a ComboBox in a class. The box never actually shows up on a form, but the variable for the box exists, and is initialized. What is confusing me is that I tried setting the datasource and valuemember of this combo box to a table in a dataset, but nothing is being put into the list of my combobox. I'm pretty confused, so some advice or suggestions would help. Thanks! ;)
-
I declare a ComboBox in a class. The box never actually shows up on a form, but the variable for the box exists, and is initialized. What is confusing me is that I tried setting the datasource and valuemember of this combo box to a table in a dataset, but nothing is being put into the list of my combobox. I'm pretty confused, so some advice or suggestions would help. Thanks! ;)
It doesn't matter if you declare a variable or not, you must add it to the parent control's
Controls
collection property, just like all the other controls. Expand the "Windows Form Designer generated code" region and look at theInitializeComponent
method that the designer code serializer uses for examples, and see theControl.Controls
property documentation in the .NET Framework SDK.Microsoft MVP, Visual C# My Articles
-
It doesn't matter if you declare a variable or not, you must add it to the parent control's
Controls
collection property, just like all the other controls. Expand the "Windows Form Designer generated code" region and look at theInitializeComponent
method that the designer code serializer uses for examples, and see theControl.Controls
property documentation in the .NET Framework SDK.Microsoft MVP, Visual C# My Articles