积极答复者
关于COMBOBOX绑定数据的一些问题

问题
-
使用COMBOBOX的DisplayMember、ValueMember绑定数据后。
1.我需要实现第一项为空,也就是selectIndex=-1;这种效果。
因为我绑定后是要用来做查询的。
2.我需要在用户使用COMBOBOX查询时,不能手动输入值,只能通过下拉来选择。
请问这样怎么实现,谢谢。- 已更改类型 周雪峰MVP, Moderator 2010年1月26日 9:26
- 已更改类型 周雪峰MVP, Moderator 2010年1月26日 9:26
答案
全部回复
-
-
你好!
这里是一个TextBox的实例:Binding b = new Binding ("Text", ds, "customers.custToOrders.OrderAmount"); // Add the delegates to the event. b.Format += new ConvertEventHandler(DecimalToCurrencyString); b.Parse += new ConvertEventHandler(CurrencyStringToDecimal); text1.DataBindings.Add(b);
周雪峰