private void cszqm_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && testlist.Visible == true) { DicObj info = testlist.SelectedItem as DicObj; cszqm.Text = info.name; testlist.Visible = false; //this.SelectNextControl(this.ActiveControl, true, true, true, true); } }
/// <summary> /// 设置自动获取签名 /// 2017-12-01 cc /// </summary> /// <param name="con">控件</param> /// <param name="diclist"></param> /// <param name="type">分类</param> public void SetData(ListBox con, List <DicObj> diclist, string type) { IList <TAB_PERSON_DATA> list = personbll.GetList(type); DataTable dt = new DataTable(); dt.Columns.Add("code", typeof(string)); dt.Columns.Add("name", typeof(string)); foreach (TAB_PERSON_DATA obj in list) { DicObj dicobj = new DicObj(); dicobj.name = obj.NAME; //获取name属性值 dicobj.code = obj.CODE; //获取name属性值 diclist.Add(dicobj); dt.Rows.Add(dicobj.code, dicobj.name); } con.DataSource = dt; con.DisplayMember = "name"; con.ValueMember = "code"; }
private void diqu_KeyDown(object sender, KeyEventArgs e) { if (globalInfoClass.Zhiwu == "护士") { if (e.KeyCode == Keys.Enter && diqulist.Visible == true) { DicObj info = diqulist.SelectedItem as DicObj; province.Text = info.name; diqulist.Visible = false; } } else { if (e.KeyCode == Keys.Enter && diqulist_doc.Visible == true) { DicObj info = diqulist_doc.SelectedItem as DicObj; province_doc.Text = info.name; diqulist_doc.Visible = false; } } }