470,641 Members | 2,653 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,641 developers. It's quick & easy.

datagrid formatting

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
Nov 21 '05 #1
3 1187
Greame,

The "nullnext" is for "Null" fields what is in VBNet "Nothing" or let us say
not filled columns.

For what you want is the format.
http://msdn.microsoft.com/library/de...ormattopic.asp

I hope this helps,

Cor
Nov 21 '05 #2
take a look at this:
http://support.microsoft.com/default...;en-us;Q318581
"Saladin" <ma****************@wave.co.nz> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
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

Nov 21 '05 #3
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.
"Saladin" <ma****************@wave.co.nz> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
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

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Matthew Wieder | last post: by
1 post views Thread by J.B | last post: by
2 posts views Thread by Sebi | last post: by
3 posts views Thread by McNutt Consulting | last post: by
5 posts views Thread by tshad | last post: by
4 posts views Thread by hope | last post: by
1 post views Thread by Michael Calvin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.