private void ReplaceText()
        {
            if (_main.TracksGridView.View.Columns[_findResult.Column].ReadOnly)
              {
            _findResult = null;
            return;
              }

              string cellContent = _main.TracksGridView.View.Rows[_findResult.Row].Cells[_findResult.Column].Value.ToString();
              string replaceString = cellContent.Substring(0, _findResult.StartPos);
              replaceString += cbReplace.Text;
              replaceString += cellContent.Substring(_findResult.StartPos + _findResult.Length);
              _main.TracksGridView.View.Rows[_findResult.Row].Cells[_findResult.Column].Value = replaceString;
              _findResult = null;
        }
        private bool FindString()
        {
            string searchString = cbFind.Text;

              if (checkBoxMatchWholeWords.Checked)
              {
            searchString = string.Format(@"\b{0}\b", searchString);
              }

              RegexOptions searchOptions = RegexOptions.CultureInvariant;
              if (!checkBoxMatchCase.Checked)
              {
            searchOptions = RegexOptions.IgnoreCase | RegexOptions.CultureInvariant;
              }

              for (int i = _curRow; i < _main.TracksGridView.View.Rows.Count; i++)
              {
            DataGridViewRow row = _main.TracksGridView.View.Rows[i];
            for (int j = _curCell; j < row.Cells.Count; j++)
            {
              if (!(_main.TracksGridView.View.Columns[j]).Visible)
              {
            continue;
              }

              string cellContent = row.Cells[j].Value == null ? "" : row.Cells[j].Value.ToString();
              cellContent = cellContent.Substring(_curCellFindPos);

              MatchCollection regexMatches = Regex.Matches(cellContent, searchString, searchOptions);
              if (regexMatches.Count > 0)
              {
            _searchStringFound = true;
            _curCell = j;
            _curRow = i;
            _curCellFindPos = regexMatches[0].Index + 1;
            _findResult = new FindResult();
            _findResult.Row = _curRow;
            _findResult.Column = _curCell;
            _findResult.StartPos = regexMatches[0].Index;
            _findResult.Length = regexMatches[0].Length;
            _main.TracksGridView.ResultFind = _findResult;

            // Position Cell and deselect row, so that we have our find color
            _main.TracksGridView.View.CurrentCell = _main.TracksGridView.View[j, i];
            _main.TracksGridView.View.Rows[i].Selected = false;
            // Repaint the cell
            _main.TracksGridView.View.InvalidateCell(_main.TracksGridView.View.CurrentCell);
            return true;
              }
              _curCellFindPos = 0;
            }
            _curCell = 0;
              }
              return false;
        }