473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1286
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Frnak McKenney | last post by:
One of the reasons given for the Allied victory in WWI is that the Nazi armament industry invested so much effort in creating new weapons (e.g. the jet plane) it wasn't able to develop any of them...
7
by: Matthew Wieder | last post by:
Hi - I have a datagrid that has a black header and the rows alternate white and gray. The problem is that until items are added to the grid, the grid appears as a large black rectangle, which is...
1
by: J.B | last post by:
I have a datagrid that will display different datasets, (it runs different sprocs based on a value in the querystring) but it will always return 6 columns. The 5th and 6th columns are always Date...
2
by: Sebi | last post by:
Hello all is it possible to add a checkbox in a DataGrid for Boolean Data? Thanks in advance
3
by: McNutt Consulting | last post by:
I'm trying to implement a datagrid with dynamically created columns. The data is coming out of a very simple XML file, and it's bound through a dataview. The datagrid is just a shell definition...
5
by: tshad | last post by:
I have been trying to figure out what the Datagrid is doing to create its formatting. I found that some of my Datagrids have a 3D type of border and sometime it has a straight line. I finally...
5
by: cwbp17 | last post by:
Hi all, Have a datagrid that displays the price column of a table. Went to the Datagrid's Property builder and set the 'Data Formatting expression' for the PRICE column to {0:c}, so that the...
4
by: hope | last post by:
Hi, How can I format a string field using Data Formatting Expression property in datagrid? For example: format last name from BROWN to Brown. Thanks
2
by: DraguVaso | last post by:
Hi, I'm looking for a nice way to format the cell of my datagrid according to some predefined 'rules'. I found a lot on the site of George shepherd, but it wasn't really what I was looking for:...
1
by: Michael Calvin | last post by:
Some basic things I cannot figure out how to do with new datagrid. 1) How do I control the formatting of the column header separately from the rest of the column? 2) If I align right the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.