473,394 Members | 1,765 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,394 software developers and data experts.

Nulls in datagrid

How do I force the vb.net datagrid to display a blank cell instead of "NULL"
when a field value in the database is null?

Thanks,
John Suru
Nov 20 '05 #1
1 3136
Hi,

If you add a tablestyle the datagridtextboxcolumn has a nulltext
property.

Private Sub SetupGrid()

Dim ts As New DataGridTableStyle

ts.MappingName = dsInvoicesData.Tables(0).TableName

Dim colDescription As New DataGridTextBoxColumn

With colDescription

..MappingName = "Description"

..HeaderText = "Description"

..Width = 280

..NullText = ""

End With

Dim colQty As New DataGridTextBoxColumn

With colQty

..MappingName = "Quantity"

..HeaderText = "Qty"

..Width = 50

End With

Dim cm As CurrencyManager = CType(Me.BindingContext(dvClient),
CurrencyManager)

Dim pd As System.ComponentModel.PropertyDescriptor =
cm.GetItemProperties()("Each")

Dim colEach As New DataGridTextBoxColumn(pd, "C")

With colEach

..MappingName = "Each"

..HeaderText = "Each"

..Width = 50

End With

Dim colPrice As New DataGridTextBoxColumn(pd, "C")

With colPrice

..MappingName = "Price"

..HeaderText = "Price"

..Width = 50

End With

ts.GridColumnStyles.Add(colDescription)

ts.GridColumnStyles.Add(colQty)

ts.GridColumnStyles.Add(colEach)

ts.GridColumnStyles.Add(colPrice)

dgInvoiceData.TableStyles.Add(ts)

ts = Nothing

colPrice = Nothing

colEach = Nothing

colQty = Nothing

colDescription = Nothing

End Sub

Ken

--------------------------------------

"John Suru" <js***@neo.rr.com> wrote in message
news:L_*****************@fe3.columbus.rr.com...
How do I force the vb.net datagrid to display a blank cell instead of "NULL" when a field value in the database is null?

Thanks,
John Suru

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dan Perlman | last post by:
From: "Dan Perlman" <dan@dpci.NOSPAM.us> Subject: ODBC creating nulls? Date: Friday, July 09, 2004 10:43 AM Hi, Below is my VB6 code that writes data from an Access 2000 table to a PG table....
2
by: Steve Walker | last post by:
Hi all. I've been tasked with "speeding up" a mid-sized production system. It is riddled with nulls... "IsNull" all over the procs, etc. Is it worth it to get rid of the nulls and not allow...
3
by: aaj | last post by:
Hi I am probably going to regret asking this because I'm sure you are going to tell me my design is bad 8-) ah well we all have to learn.... anyway I often use Nulls as a marker to see if...
6
by: mike | last post by:
I'm doing what I thought was a simple GROUP BY summary of fairly simple data and the my numbers aren't working out Some results are showing up <NULL> when I know the data is in the database ...
0
by: Rhino | last post by:
I am working with SQL Functions in DB2 for Windows/Linux/UNIX (V8.2.1) and am having a problem setting input parameters for SQL Functions to null in the Development Center. My simple function,...
1
by: PST | last post by:
Here's a problem I'm trying to deal with: I'm working on a Frontpage 2000 website for a boat handicapping system, built in Access 97. What I'm trying to accomplish is: The user enters a...
8
by: drg | last post by:
I have a DataSet with a DateTime field. I am using an EventRow r, to update it with values from a TextBox in a DataGrid. Suppose a DataGrid in edit mode had a field with value: 7/7/2005. Then the...
8
by: Mike | last post by:
The current databas structure that i'm working with allowed NULL's an now I'm converting the app to .NET and it will not allow NULLs in the fields when populated. So my question is, how can i...
6
by: Cliff72 | last post by:
I need to fill in the nulls in the batch field the value from the record immediately preceding the null one ie replace the nulls with the preceding value until I hit a record with a value in...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.