mike Delvotti

mike Delvotti

  • NA
  • 262
  • 0

Remove whitespace from middle of string in datagrid

Mar 28 2012 4:37 AM
Guys, I'm trying to remove the whitespace in the middle of a string within a datagridview cell, i think i'm close with the below but it doesn't do anything?

foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (row.IsNewRow) break;
                object obj = row.Cells[8].Value;
                {
                    string trim = Regex.Replace(Text, @"\s+", " ").Trim();
                   
                }
            }

so i want the output in row.cells[8] to change from this: 123 456 to end up as this: 123456

Answers (2)