跪求

wbxiaozhong 2010-08-09 02:02:02
combobox中做了搜索,现在的问题是只能用鼠标来点击,比方我输了0以0开头的值有5个,显示出来五个值后,我不可以用方向键来选择。private void cbDestStore_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(cbDestStore.Text.Length>0 && cbDestStore.SelectionLength>0)
{
//cbDestStore.Text = "";
}
cbDestStore.DroppedDown = true;
string txt = cbDestStore.Text;
int len = cbDestStore.Text.Length;
cbDestStore.SelectedIndex = -1;
if(dtDestStore != null && dtDestStore.Rows.Count > 0)
{
DataView dv = dtDestStore.DefaultView;

dv.RowFilter=FGetStoreByUserData.m_Store.ToUpper() + " like '" + cbDestStore.Text.ToUpper() + "%'";
//cbDestStore.KeyDown
cbDestStore.DataSource = dv;
cbDestStore.DisplayMember = FGetStoreByUserData.m_StoreName;
cbDestStore.ValueMember = FGetStoreByUserData.m_Store;
//cbDestStore.Text = txt;
//cbDestStore.SelectionStart=len;

}
}
现在将代码发上,请高手瞅瞅,我的是vs03版本
...全文
78 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wbxiaozhong 2010-08-12
  • 打赏
  • 举报
回复
03的版本实现不了,我试过很多次了。这功能公司不准备做了
mayonglong 2010-08-09
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 wbxiaozhong 的回复:]
cbDestStore_KeyPress是在这个方法里
[/Quote]

lz试试~
Alfredknox 2010-08-09
  • 打赏
  • 举报
回复
应该要判断按哪个键啊
wbxiaozhong 2010-08-09
  • 打赏
  • 举报
回复
干过了
lyangelwing 2010-08-09
  • 打赏
  • 举报
回复
点击你的combox控件

找到它的事件

然后双击 cbDestStore_KeyPress 事件

然后把代码复制进去
exiori 2010-08-09
  • 打赏
  • 举报
回复
KEYPSRESS
wbxiaozhong 2010-08-09
  • 打赏
  • 举报
回复
cbDestStore_KeyPress是在这个方法里

110,545

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧