USING REGEX AND LOOPING THROUGH SPECIFIC COLUMN DATAGRIDVIEW
Hi how can I use regex when looping through DataGridViewRow, with this
code I got no error but also no resulat :( The regex expression works fine
"thanks to stackoverflow members" when used on string array, but how to
use it on datagridview, whatever the expression of course. Thanks for your
help.
foreach (DataGridViewRow row in dtGrid.Rows)
{
var regex = new Regex(@"\W+[Ff]*(?=\W|$)");
DataGridViewCell cell = row.Cells[1];
if (cell.Value == null || cell.Value.Equals(""))
{
continue;
}
cell.Value = regex.Replace(cell.Value.ToString(), "");
}
// Refresh datagridview
dtGrid.Refresh();
No comments:
Post a Comment