private void RootDatagrid_CellClick(object sender, DataGridViewCellEventArgs e) { DataGridViewRow row = new DataGridViewRow(); clsParsingExtraction objExtract = new clsParsingExtraction(); string RootWord = string.Empty; int i = e.RowIndex; if (i != -1) { row = RootDatagrid.Rows[i]; RootWord = row.Cells[1].Value.ToString(); } //label2.Text = "List of Words in the Tolkappiyam with Root '" + RootWord + "'"; label2.Text = "'" + RootWord + "' வேர்ச்சொல்லையுடைய தொல்காப்பியச் சொற்பட்டியல் "; List <string> lstParserDetails = new List <string>(); lstParserDetails = objExtract.RetrieveParsingDetailsWithRoot(RootWord); List <WordExtraction> lstRoots = new List <WordExtraction>(); int num = 1; foreach (string output in lstParserDetails) { WordExtraction objword = new WordExtraction(); objword.எண் = num; objword.சொல் = output; lstRoots.Add(objword); num = num + 1; } InflectedDatagrid.DataSource = lstRoots; InflectedDatagrid.Columns[0].Width = 40; InflectedDatagrid.Columns[1].Width = 180; rtbDetails.Clear(); }
private void cmbRoot_SelectedIndexChanged(object sender, EventArgs e) { cmbRoot.Text = cmbRoot.SelectedItem.ToString(); string wordTobeSearched = cmbRoot.SelectedItem.ToString(); string cellValue = string.Empty; List <string> lstrowindex = new List <string>(); if (!string.IsNullOrEmpty(wordTobeSearched)) { foreach (DataGridViewRow row1 in RootDatagrid.Rows) { try { cellValue = row1.Cells[1].Value.ToString(); } catch (Exception ex) { } if (cellValue != null && (cellValue == wordTobeSearched || cellValue.StartsWith(wordTobeSearched))) { if (cellValue == wordTobeSearched) { lstrowindex.Add(row1.Index.ToString()); break; } } } if (lstrowindex.Count > 0) { RootDatagrid.Rows[0].Selected = false; RootDatagrid.Rows[Int32.Parse(lstrowindex[0])].Selected = true; RootDatagrid.CurrentCell = RootDatagrid[0, Int32.Parse(lstrowindex[0])]; } DataGridViewRow row = new DataGridViewRow(); clsParsingExtraction objExtract = new clsParsingExtraction(); string RootWord = string.Empty; int i = Int32.Parse(lstrowindex[0]); if (i != -1) { row = RootDatagrid.Rows[i]; RootWord = row.Cells[1].Value.ToString(); } label2.Text = "List of Words in the Tolkappiyam with Root '" + RootWord + "'"; List <string> lstParserDetails = new List <string>(); lstParserDetails = objExtract.RetrieveParsingDetailsWithRoot(RootWord); List <WordExtraction> lstRoots = new List <WordExtraction>(); int num = 1; foreach (string output in lstParserDetails) { WordExtraction objword = new WordExtraction(); objword.எண் = num; objword.சொல் = output; lstRoots.Add(objword); num = num + 1; } InflectedDatagrid.DataSource = lstRoots; InflectedDatagrid.Columns[0].Width = 40; InflectedDatagrid.Columns[1].Width = 180; rtbDetails.Clear(); } }