private void dataGridView_RowEnter(object sender, DataGridViewCellEventArgs e) { //if (dataGridView.CurrentRow == null) //{ // rtbCode.Clear(); // return; //} _CurrentCode = new RtfCreator(dataGridView.Rows[e.RowIndex].Cells["Text"].Value.ToString()); rtbCode.Clear(); switch (dataGridView.Rows[e.RowIndex].Cells["Language"].Value.ToString()) { case "JS": ConvertJsToRtf(); break; case "SBL": ConvertBasicToRtf(); break; default: //rtbCode.Text = dataGridView.CurrentRow.Cells["Text"].Value.ToString(); //rtbCode.Rtf = _CurrentCode.Rtf; ConvertOtherToRtf(); break; } //_rtfWithoutMatches = _CurrentCode.Rtf; //rtbCode.Rtf = _rtfWithoutMatches; rtbCode.Rtf = _CurrentCode.Rtf; ConditionsSearchChanged(); }
private void btnSearchInDB_Click(object sender, EventArgs e) { try { rtbCode.Clear(); _CurrentCode = null; DataSet ds = new DataSet(); //SqlCommand cmd = new SqlCommand(GetSqlExpr(), SQL_CONNECTION); SqlCommand cmd = new SqlCommand(GetSqlExpr(), SQL_CONNECTION); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); /*SQL_CONNECTION.Open(); * MessageBox.Show(SQL_CONNECTION.ServerVersion); * SQL_CONNECTION.Close();*/ dataGridView.DataSource = ds.Tables[0]; //txtBxSearch.Text = Regex.Replace(rtbTextSearcSpec.Text, "%", ""); // CalcRegexForSearchInCode(); // //SQL_CONNECTION.ServerVersion this.Text = (string)(this.Tag) + " Found " + ds.Tables[0].Rows.Count; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//private string _rtfWithoutMatches = string.Empty; private void Form1_Load(object sender, EventArgs e) { RtfCreator.AddColor("Comment", Color.Green); RtfCreator.AddColor("Matched", Color.Khaki); RtfCreator.AddColor("parentheses1", Color.Brown); RtfCreator.AddColor("parentheses2", Color.Blue); RtfCreator.AddColor("parentheses3", Color.Violet); RtfCreator.AddColor("parentheses4", Color.Orange); RtfCreator.AddColor("parentheses5", Color.Red); // ConvertOtherToRtf(); }