datagrid formatting

  • Thread starter Thread starter Saladin
  • Start date Start date
S

Saladin

Hi

VB.NET, Desktop app
I have an Access table with numeric fields filled mainly with 0 (zeros).
When I bind with datagrid, I don't want the zeros to show (ie: I want blank
cells). Now I've tried formatting using DataGridTableStyle (which works fine
for nulls etc) but no success so far getting rid of the annoying zeros.
Snippet ...

myColumn = New DataGridTextBoxColumn

With myColumn

..MappingName = "FreightFirmCode"

..NullText = ""

..Alignment = HorizontalAlignment.Center

..Width = 104

End With

myTableStyle.GridColumnStyles.Add(myColumn)

So how to display blanks please? Maybe forecolor = grid bg color unless <>0?
But couldn't get that to work either.



Thanks!

Graeme
 
Thanks both. Looked a bit tricky to me so I went back to database and made
def = null instead of 0, then handled it ok. Should have thought about that
before.
 
Back
Top