|
|
@@ -59,6 +59,8 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
|
|
|
private string selectField;
|
|
|
DataTable dt = new DataTable();
|
|
|
|
|
|
+ private DataTable returnData;
|
|
|
+
|
|
|
public override string Text
|
|
|
{
|
|
|
get
|
|
|
@@ -203,6 +205,19 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
|
|
|
TextBoxEnable1 = value;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public DataTable ReturnData
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return returnData;
|
|
|
+ }
|
|
|
+
|
|
|
+ set
|
|
|
+ {
|
|
|
+ returnData = value;
|
|
|
+ }
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
#region 自定义事件
|
|
|
@@ -216,6 +231,10 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
|
|
|
/// </summary>
|
|
|
public event Icon_Click SearchIconClick;
|
|
|
|
|
|
+ public delegate void DBSourceChange(object sender, EventArgs e);
|
|
|
+
|
|
|
+ public event DBSourceChange DbChange;
|
|
|
+
|
|
|
public delegate void OnTextKeyDown(object sender, KeyEventArgs e);
|
|
|
|
|
|
public event OnTextKeyDown TextKeyDown;
|
|
|
@@ -242,6 +261,7 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
|
|
|
SearchIconClick?.Invoke(sender, new EventArgs());
|
|
|
DbFind db = new DbFind(Name, tableName, selectField, setValueField, caller, formName, condition);
|
|
|
db.Text = DBTitle1;
|
|
|
+ db.FormClosing += Db_FormClosing;
|
|
|
LogManager.DoLog("DbFind查询,发起窗口【" + formName + "】,查询表【" + tableName + "】,字段" + selectField + ",条件" + condition);
|
|
|
if (db.IsAbleDbFind1)
|
|
|
{
|
|
|
@@ -253,6 +273,17 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 触发给界面的
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="sender"></param>
|
|
|
+ /// <param name="e"></param>
|
|
|
+ public void Db_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
+ {
|
|
|
+ returnData = dt;
|
|
|
+ DbChange?.Invoke(sender, new EventArgs());
|
|
|
+ }
|
|
|
+
|
|
|
private void TextBox_Enter(object sender, EventArgs e)
|
|
|
{
|
|
|
TextBox.BackColor = System.Drawing.Color.GreenYellow;
|
|
|
@@ -329,16 +360,17 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
|
|
|
sql += " and " + condition;
|
|
|
}
|
|
|
dt = (DataTable)dh.ExecuteSql(sql, "select");
|
|
|
+ returnData = dt;
|
|
|
//先判断DataTable里面是否有这个字段,然后从打开的窗口里面去获取到这个Form,从Form中的指定Panel获取到指定字段的控件
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- FormCollection fmCollection = Application.OpenForms;
|
|
|
- ControlCollection controls = (ControlCollection)fmCollection[FormName].Controls;
|
|
|
- for (int i = 0; i < dt.Columns.Count; i++)
|
|
|
- {
|
|
|
- fillControl(i, fmCollection[FormName]);
|
|
|
- }
|
|
|
- }
|
|
|
+ //if (dt.Rows.Count > 0)
|
|
|
+ //{
|
|
|
+ // FormCollection fmCollection = Application.OpenForms;
|
|
|
+ // ControlCollection controls = (ControlCollection)fmCollection[FormName].Controls;
|
|
|
+ // for (int i = 0; i < dt.Columns.Count; i++)
|
|
|
+ // {
|
|
|
+ // fillControl(i, fmCollection[FormName]);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
}
|
|
|
}
|
|
|
}
|