if (combo_View.Text == "Orders")
{
DateTime date = new DateTime();
string PO, item, repack, UPS, wrapping, usage, price, notes, customerName;
int inOrder, outOrder, oid, palletNum, vid, cid;
double weight, cf;
string myIndex = dgv_DataLookup.CurrentCell.OwningRow.Cells[16].Value.ToString();
DataSet editSet = new DataSet();
da.SelectCommand = new OleDbCommand("SELECT oid, orderDate, PO, itemNum, InOrder, OutOrder, Repack, UPS, Pallets, PalletWrap, PalletUse, UPSAmount, LBS, CF, NoteOrder, VendorID, CustomerID, CustomerName FROM TestQuery WHERE oid = @oid", cs);
da.SelectCommand.Parameters.Add("@oid", OleDbType.Integer).Value = myIndex;
editSet.Clear();
da.Fill(editSet);
oid = int.Parse(editSet.Tables[0].Rows[0][0].ToString());
date = DateTime.Parse(editSet.Tables[0].Rows[0][1].ToString());
PO = editSet.Tables[0].Rows[0][2].ToString();
item = editSet.Tables[0].Rows[0][3].ToString();
inOrder = int.Parse(editSet.Tables[0].Rows[0][4].ToString());
outOrder = int.Parse(editSet.Tables[0].Rows[0][5].ToString());
repack = editSet.Tables[0].Rows[0][6].ToString();
UPS = editSet.Tables[0].Rows[0][7].ToString();
palletNum = int.Parse(editSet.Tables[0].Rows[0][8].ToString());
wrapping = editSet.Tables[0].Rows[0][9].ToString();
usage = editSet.Tables[0].Rows[0][10].ToString();
price = editSet.Tables[0].Rows[0][11].ToString();
weight = double.Parse(editSet.Tables[0].Rows[0][12].ToString());
cf = double.Parse(editSet.Tables[0].Rows[0][13].ToString());
notes = editSet.Tables[0].Rows[0][14].ToString();
vid = int.Parse(editSet.Tables[0].Rows[0][15].ToString());
cid = int.Parse(editSet.Tables[0].Rows[0][16].ToString());
customerName = editSet.Tables[0].Rows[0][17].ToString();
Edit editForm = new Edit("ORDER", oid, date, PO, item, inOrder, outOrder, repack, UPS, palletNum, wrapping, usage, price, weight, cf, notes, vid, cid, customerName);
editForm.Show();
btn_Search_Click(null, null);
这里发生的事情是,当表单显示时,它会在我对其他表单执行任何操作之前调用btn_search_click。我想知道我是否可以暂停表单或让它睡眠,直到我退出editForm函数,然后调用搜索功能。请询问您是否需要更多代码,或者是否要查看其他表单中的代码。谢谢!
答案 0 :(得分:1)
更改
editForm.Show();
到
editForm.ShowDialog();
这将暂停执行主窗体,直到editForm关闭。