datagrid formatting

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
 
S

Saladin

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top