using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace FCM0000 { public partial class fLovProject : Form { string keyword = string.Empty; public fLovProject(string search_) { InitializeComponent(); this.keyword = search_; this.KeyPreview = true; this.KeyDown += (s1, e1) => { if (e1.KeyCode == Keys.Escape) this.Close(); }; } private void fLovItem_Load(object sender, EventArgs e) { //search data this.ta.FillSearch(this.dsMSSQL.Projects,this.keyword); } private void itemsBindingNavigatorSaveItem_Click(object sender, EventArgs e) { if (ProjectName.isEmpty() || Project == -1) DialogResult = System.Windows.Forms.DialogResult.Cancel; else DialogResult = System.Windows.Forms.DialogResult.OK; } public string ProjectName = string.Empty; public int Project = -1; private void bs_CurrentChanged(object sender, EventArgs e) { } private void dv_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { var drv = bs.Current as DataRowView; if (drv == null) { ProjectName = string.Empty; Project = -1; return; } else { var dr = drv.Row as dsMSSQL.ProjectsRow; Project = dr.idx; ProjectName = dr.name; } btOK.PerformClick(); } } } }