private void update_common_parts() { System.Text.RegularExpressions.MatchCollection cnc1; System.Text.RegularExpressions.MatchCollection cnc2; System.Text.RegularExpressions.Regex rx = new System.Text.RegularExpressions.Regex(Properties.Settings.Default.CNCProgramRegex); if (comboBox1.SelectedItem != null) { cnc1 = rx.Matches((comboBox1.SelectedItem as DataRowView)[@"CNC1"].ToString()); cnc2 = rx.Matches((comboBox1.SelectedItem as DataRowView)[@"CNC2"].ToString()); string cnc1string = string.Empty; string cnc2string = string.Empty; if (cnc1.Count > 0) { cnc1string = '%' + cnc1[0].Value + '%'; } if (cnc2.Count > 0) { cnc2string = '%' + cnc2[0].Value + '%'; } ENGINEERINGDataSet.CUT_PARTSDataTable c = cUT_PARTSTableAdapter.GetDataByCNCProg(cnc1string, cnc2string); listBox5.DataSource = c; if (checkBox1.Checked && cnc1string != string.Empty) { comboBox1.DataSource = c; } } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (!(comboBox1.DataSource is BindingSource)) { ENGINEERINGDataSet.CUT_PARTSDataTable c = (ENGINEERINGDataSet.CUT_PARTSDataTable)comboBox1.DataSource; textBox1.Text = (string)c[comboBox1.SelectedIndex][@"CNC1"]; textBox2.Text = (string)c[comboBox1.SelectedIndex][@"CNC2"]; } get_priorities(); if (!checkBox1.Checked && comboBox1.Focused && !listBox5.Focused) { update_common_parts(); } }
private void listBox5_SelectedIndexChanged(object sender, EventArgs e) { string partnum = (string)(listBox5.Items[listBox5.SelectedIndex] as DataRowView)[@"PARTNUM"]; if (listBox5.Focused) { comboBox1.SelectedIndex = comboBox1.FindString(partnum); if (!(comboBox1.DataSource is BindingSource)) { ENGINEERINGDataSet.CUT_PARTSDataTable c = (ENGINEERINGDataSet.CUT_PARTSDataTable)comboBox1.DataSource; textBox1.Text = (string)c[comboBox1.SelectedIndex][@"CNC1"]; textBox2.Text = (string)c[comboBox1.SelectedIndex][@"CNC2"]; } } }