comboBoxEX 控件奇怪的问题 程序中有一个comboBoxEX ,经过绑定之后 text属性 有一个具体的值,但是 items.count==0 这是怎么回事? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你问问comboBoxEX的作者,是不是忘记更新Count属性了 我是form_load 运行到最后一行,然后使用quick watch 查看,属性如上面所说,这是怎么回事 我没有用绑定,而是从结果集一条一条添加到combox 的 private void 录入保健EditForm_Load(object sender, EventArgs e) { this.textBox手牌编号.Text = this.acc.手牌编号; this.textBox保健名称.Text = this.保健点选.保健项.项目名称; DataBindTools.Bind_知识名称(this.comboBoxEx起钟类型, CommonConfigs.ProgId, "起钟类型"); this.comboBoxEx起钟类型.SelectedIndex = 0; this.BindComBox钟房编号(); this.OnRefresh(); } private void OnRefresh() { this.BindComBox技师(this.comboBox技师编号,this.comboBoxEx起钟类型.Text=="轮牌"); this.dateTimeInput落钟时间.Value = DateTime.Now; this.dateTimeInput起钟时间.Value = this.dateTimeInput落钟时间.Value.AddMinutes(-this.保健点选.保健项.时间); }-------------------------------private void BindComBox技师(ComboBox cbox, bool 轮牌) { cbox.Items.Clear(); if (轮牌) { 保健价目DataSet.保健项目Row a = ConsoleService.Instance.保健价目DataSet.保健项目.First(p => p.项目名称 == this.textBox保健名称.Text); var q = from c in this.SpringDB.技师_排钟队列.Where(p => p.钟牌状态 == "正常") join o in this.SpringDB.技师_当前状态.Where(p => p.当前状态 == "空闲") on c.技师编号 equals o.技师编号 select new { c.排队序号, c.消费类别, c.钟牌状态, c.技师编号 }; if (q == null || q.Count() <= 0) return; if (q.Where(p => p.消费类别 == a.消费类别 && p.钟牌状态 == "正常").Select(p => p.排队序号).Count() > 0) { DateTime firstTime = (DateTime)q.Where(p => p.消费类别 == a.消费类别 && p.钟牌状态 == "正常").Select(p => p.排队序号).Min(); var f = q.Where(p => p.消费类别 == a.消费类别).FirstOrDefault(p => p.排队序号 == firstTime); cbox.Items.Add(f.技师编号); } } else { foreach (技师_当前状态 s in this.SpringDB.技师_当前状态.Where(p => p.当前状态 == "空闲")) { cbox.Items.Add(s.技师编号); } } if (this.comboBox技师编号.Items.Count > 0) this.comboBox技师编号.SelectedIndex = 0; }----------------------------- private void comboBoxEx起钟类型_SelectedIndexChanged(object sender, EventArgs e) { const string 轮牌 = "轮牌"; this.BindComBox技师(this.comboBox技师编号, this.comboBoxEx起钟类型.Text == 轮牌); //this.comboBox技师编号.Enabled = this.comboBoxEx起钟类型.Text == 轮牌 ? false : true; } 求高手赐教 C#怎么解决动态生成PANEL时的闪烁问题? 数据库表对应Models层类代码生成器,用C#写的 c#用DirectShow开发播放器如何实现全屏? 关于代码重构的一些疑问 VC#中,属性框这个控件叫什么名字,我们能用不? 如何将存储过程中查询出来的结果返回给C#中 C# label实现渐变效果 很菜的问题:Monitor.enter和lock的用法和区别? 新手上路急问:怎么控制TextBox中输入的格式为yyyy/mm/dd hh:mm? 写在什么事件里? VS2005支持.NET3.0及以后更高的版本吗? C#创建excel文件的问题!
{
this.textBox手牌编号.Text = this.acc.手牌编号;
this.textBox保健名称.Text = this.保健点选.保健项.项目名称;
DataBindTools.Bind_知识名称(this.comboBoxEx起钟类型, CommonConfigs.ProgId, "起钟类型");
this.comboBoxEx起钟类型.SelectedIndex = 0;
this.BindComBox钟房编号(); this.OnRefresh();
} private void OnRefresh()
{
this.BindComBox技师(this.comboBox技师编号,this.comboBoxEx起钟类型.Text=="轮牌");
this.dateTimeInput落钟时间.Value = DateTime.Now;
this.dateTimeInput起钟时间.Value = this.dateTimeInput落钟时间.Value.AddMinutes(-this.保健点选.保健项.时间);
}-------------------------------
private void BindComBox技师(ComboBox cbox, bool 轮牌)
{
cbox.Items.Clear(); if (轮牌)
{
保健价目DataSet.保健项目Row a = ConsoleService.Instance.保健价目DataSet.保健项目.First(p => p.项目名称 == this.textBox保健名称.Text);
var q = from c in this.SpringDB.技师_排钟队列.Where(p => p.钟牌状态 == "正常")
join o in this.SpringDB.技师_当前状态.Where(p => p.当前状态 == "空闲") on c.技师编号
equals o.技师编号
select new
{
c.排队序号,
c.消费类别,
c.钟牌状态,
c.技师编号
}; if (q == null || q.Count() <= 0)
return; if (q.Where(p => p.消费类别 == a.消费类别 && p.钟牌状态 == "正常").Select(p => p.排队序号).Count() > 0)
{
DateTime firstTime = (DateTime)q.Where(p => p.消费类别 == a.消费类别 && p.钟牌状态 == "正常").Select(p => p.排队序号).Min();
var f = q.Where(p => p.消费类别 == a.消费类别).FirstOrDefault(p => p.排队序号 == firstTime); cbox.Items.Add(f.技师编号);
}
}
else
{
foreach (技师_当前状态 s in this.SpringDB.技师_当前状态.Where(p => p.当前状态 == "空闲"))
{
cbox.Items.Add(s.技师编号);
}
}
if (this.comboBox技师编号.Items.Count > 0)
this.comboBox技师编号.SelectedIndex = 0;
}----------------------------- private void comboBoxEx起钟类型_SelectedIndexChanged(object sender, EventArgs e)
{
const string 轮牌 = "轮牌";
this.BindComBox技师(this.comboBox技师编号, this.comboBoxEx起钟类型.Text == 轮牌);
//this.comboBox技师编号.Enabled = this.comboBoxEx起钟类型.Text == 轮牌 ? false : true;
}