Are you sure you want to bind to the column in dt that is reflected by
caption? You should be using "Name" instead as the property to bind to, not
what is returned by the Caption property.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
<ka************@gmail.comwrote in message
news:11**********************@y5g2000hsa.googlegro ups.com...
>
Combo Box DropDown Style.
A combo box is bound to a data table field name.
When combo box has simple / drop down style then bound is successful.
Other hand if Combo box has drop down list style then bound is
successful but combo box not show data field names.
E.g
1.
cmbName.DropDownStyle =
System.Windows.Forms.ComboBoxStyle.DropDownList ;
cmbName.DataBindings.Clear();
cmbNameOTR.DataBindings.Add("text", dt, dt.Columns["Name"].Caption);
Here in above code data binding is successful but did not show
anything.
2.
cmbName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown ;
cmbName.DataBindings.Clear();
cmbNameOTR.DataBindings.Add("text", dt, dt.Columns["Name"].Caption);
Here in this example when combo box has Simple or drop down style then
it responses good, with data binding and displaying data as well.