Private voidButton3_Click (Objectsender, EventArgs e) { introw = DataGridView1.Rows.Count;//get total number of rows intcell=datagridview1.rows[1]. Cells.count;//get total number of columns stringStrtxt = Txtfind.text;//get the input string and pay the value to the variableRegex r =NewRegex (Strtxt);//defining a Regex object instance for(inti =0; i < row; i++)//get the total number of rows and loop within { for(intj =0; J < Cell; J + +)//get the total number of columns and loop within{Match m= R.match (Datagridview1.rows.cells[j]. Value.tostring ());//fuzzy Matching in a string if(m.success) {//compares the values in the Texbox with the values in the DataGridView (the sentence above)Datagridview1.currentcell = Datagridview1[j,i];//navigate to the same cell if(MessageBox.Show ("do you want to continue searching? ","", messageboxbuttons.okcancel) = =dialogresult.cancel) {//if Cancel is selected, it returns, and if OK is selected, the match will continue to be found. return;//return } } } } }
C # DataGridView Search