Skip to content

Suppressing zeroes or forcing a space in a data Grid

George Laing

Asked Jan 7, 2009, 8:46 AM EST1 answer
Share
LinkedInX

Hi
  I have a datagrid and I would like to either replace zero's with a space or suppress them. I have tried just putting in a space but that did not work. The field used to have -Infinity in it so I forced a zero with this line

C#
 if (Grid_Property.Rows[i].Cells["pDiff"].Value.ToString() == "-Infinity")
                {
                    Grid_Property.Rows[i].Cells["pDiff"].Value = "";
                }
I tried to add to string in the if statement but that did not work see below
if (Grid_Property.Rows[i].Cells["pDiff"].Value.ToString() == "-Infinity")
                {
                    Grid_Property.Rows[i].Cells["pDiff"].Value.ToString = "";
                }

Any help would be appreciated

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    hi
    if you got your if condition returns true and you are getting error in assigning blank string then you can try String.Empty to assign blank string

    hope this would help you
    0