private void killButton_Click(object sender, EventArgs e) { System.Windows.Forms.ListBox.SelectedObjectCollection coll = listBox1.SelectedItems; string name = (string)coll[0]; killProcess(name); getProcesses(); }
public static System.Windows.Forms.ListBox.SelectedObjectCollection get_SelectedItemsTSS( System.Windows.Forms.ListBox target) { target.Items.Add("Testing"); target.Items.Add("Testing1"); target.Items.Add("Testing2"); System.Windows.Forms.ListBox.SelectedObjectCollection colll = new System.Windows.Forms.ListBox.SelectedObjectCollection(target); colll.Add("Testing"); return(colll); }
//---------------------------------------------------------------------- private List <string> getDescripcionesListBox() { List <string> descripciones = new List <string>(); System.Windows.Forms.ListBox.SelectedObjectCollection coleccion = funcionalidadesCheckedListBox.SelectedItems; foreach (Object objeto in coleccion) { descripciones.Add(objeto.ToString()); } return(descripciones); }
/// <summary> /// 删除以选择项 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { if (clbTypes.CheckedItems.Count > 0) { System.Windows.Forms.ListBox.SelectedObjectCollection list = clbTypes.SelectedItems; //获取选择项 foreach (var item in clbTypes.CheckedItems) { NurNewsTypeModel tp = item as NurNewsTypeModel; //删除集合中的 types = types.Where(n => n.TypeID != tp.TypeID).ToList(); } //重新赋值集合 DataBingToSelectBox(); } }
/// <summary> /// Displays content for creating a new test batch /// </summary> private void DisplayCreateBatch() { ScriptInfo[] available_tests; states.Push((int)state.CreateBatch); String instr = "Select one or more tests from the list of available tests, then click the right arrow button to add them to the test batch. " + "Give the test batch a name, an optional description, and click Create."; SetupForm(instr, "Create Test Batch", Properties.Resources.settings64); //the form is not big enough for this step so we have to resize it, and move the next, back buttons btn_back.Top = 500; btn_next.Top = btn_back.Location.Y; this.Height = 655; //Display content btn_next.Text = "Create"; pnl_content.Controls.Add(grp_create_batch); pnl_content.Controls.Add(grp_create_batch_information); pnl_steps.Height = pnl_content.Height; //Display tasks tasks.ModifyImage(states.Count - 2, Properties.Resources.arrow_gray); tasks.AddTask(Properties.Resources.arrow, "Create Batch", 15); tasks.Display(pnl_steps); //add the test to the list of available tests lst_available_tests.Items.Clear(); available_tests = test.RetrieveTests(); //check to see if an error occurred if (available_tests == null) { MessageBox.Show(test.Error, "Error", MessageBoxButtons.OK, test.ErrorType); } else { for (int x = 0; x < available_tests.Length; x++) { lst_available_tests.Items.Add(available_tests[x]); } } System.Windows.Forms.ListBox.SelectedObjectCollection t = lst_available_tests.SelectedItems; }
private void btnToLeft_Click(object sender, EventArgs e) { System.Windows.Forms.ListBox.SelectedObjectCollection selectedItems = listNotUsedPg.SelectedItems; foreach (PluginModel pm in selectedItems) { TreeNode subTn = new TreeNode(); subTn.Name = pm.GUID; subTn.Text = pm.Text; subTn.Tag = pm; treeMenu.SelectedNode.Nodes.Add(subTn); treeMenu.SelectedNode.Expand(); } for (int i = listNotUsedPg.Items.Count - 1; i > -1; i--) { if (listNotUsedPg.GetSelected(i)) { listNotUsedPg.Items.RemoveAt(i); } } }
private void button8_Click(object sender, EventArgs e) { // string strSql2 = "select bb.零件号 as Part from store_state bb where bb.名称='蒙皮'and bb.最后架次<>'No'"; // List<string> skinlist = new List<string>(); // List<string> jiacilist = new List<string>(); // List<string> newjiacilist = new List<string>(); System.Windows.Forms.ListBox.SelectedObjectCollection selectedDoc = this.listBox2.SelectedItems; // jiacilist = DbHelperSQL.getlist("select 架次 from store_state_all group by 架次"); /* foreach(string pp in jiacilist) * { * string npp =pp.Substring(0, 14); * if(!newjiacilist.Contains(npp)) * { * newjiacilist.Add(npp); * } * * } */ foreach (string nnp in selectedDoc) { // string newkk = kk.Substring(0, 9); string sql1 = "(select a.工位号,a.零件号,b.站位 from store_state a left join station b on a.工位号=b.工位 where a.名称='蒙皮' Or a.名称 like 'SKIN%')"; string sql2 = "(select 零件号,日期 from store_state_all where 架次 = '" + nnp + "')"; string sql3 = "select aa.零件号 as skinPart,aa.站位 as LS,aa.工位号 as station,bb.日期 as fajian from" + sql1 + " aa left join " + sql2 + " bb on aa.零件号=bb.零件号"; System.Data.DataTable table1; table1 = DbHelperSQL.Query(sql3.ToString()).Tables[0]; dynamic wSheet = excelMethod.SaveDataTableToExcel(table1); /* int editqty = table1.Rows.Count; * int offsetqty = table1.Columns.Count; * for (int i = 0; i < editqty; i++) * { * string newkk = table1.Rows[i][0].ToString().Substring(0, 9); * string newkkrear = table1.Rows[i][0].ToString().Substring(10, 3); * int newkkrearint = Convert.ToInt32(newkkrear); * string productpart = ""; * for (int m = newkkrearint; m > 0; m -= 2) * { * string rearconvert = m.ToString().PadLeft(3, '0'); * StringBuilder strSql2 = new StringBuilder(); * strSql2.Append("select NHA from partstate "); * strSql2.Append(string.Format("where PARTNUMBER like '{0}%';", newkk + "-" + rearconvert)); * System.Data.DataTable dt = DbHelperSQL.Query(strSql2.ToString()).Tables[0]; * if (dt.Rows.Count != 0) * { * wSheet.Cells[i + 2, 1 + offsetqty] = dt.Rows[0][0]; * productpart = dt.Rows[0][0].ToString(); * } * * } * * * * * StringBuilder strSql3 = new StringBuilder(); * strSql3.Append("select TITLE from partstate "); * strSql3.Append(string.Format("where PARTNUMBER like '{0}%';", productpart)); * //DbHelperSQL.getlist(strSql3).First().ToString() * //excelTable.Columns[i].ColumnName; * wSheet.Cells[i + 2, 2 + offsetqty] = DbHelperSQL.getlist(strSql3.ToString()).First().ToString(); * } * wSheet.Cells[1, 1 + offsetqty] = "ProductNo"; * wSheet.Cells[1, 2 + offsetqty] = "ProductName"; * */ // string sql4 = "( select NHA,TITLE from from partstate where PARTNUMBER like '" + newkk + "%'"; //excelMethod.SaveDataTableToExcel_offset wSheet.Columns.AutoFit(); dynamic dateColumn = wSheet.Columns[4]; dateColumn.NumberFormat = "yyyy-mm-dd"; //wSheet. } }