Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to remove dafault nulls from the datagrid on the form?

Posted on 2006-06-27
3
Medium Priority
?
177 Views
Last Modified: 2010-04-23
My code is:

 Dim ds As New DataSet
        dt = ds.Tables.Add("CourseInfo")
        dt.Columns.Add("Course", GetType(String))
        dt.Columns.Add("Course Date (MMDDYY)", GetType(String))


        grdCourse.DataSource = dt
        Dim ts As New DataGridTableStyle
        ts.MappingName = "CourseInfo"
        grdCourse.TableStyles.Clear()
        grdCourse.TableStyles.Add(ts)

        ts.GridColumnStyles(0).Width = 150
        ts.GridColumnStyles(1).Width = 170

When entering the valus on the form, I see the word null in the datagrid.
How can I get rid of that?

Please help.

Thanks.
0
Comment
Question by:Reeds
  • 3
3 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 16994919
Dim i As Integer
        For i = 0 To dt.Columns.Count
            dt.Columns(i).DefaultValue = ""
        Next
0
 
LVL 35

Expert Comment

by:YZlat
ID: 16994922
sorry, use

Dim i As Integer
        For i = 0 To dt.Columns.Count - 1
            dt.Columns(i).DefaultValue = ""
        Next
0
 
LVL 35

Accepted Solution

by:
YZlat earned 2000 total points
ID: 16994931
Dim ds As New DataSet
Dim i as integer
        dt = ds.Tables.Add("CourseInfo")
        dt.Columns.Add("Course", GetType(String))
        dt.Columns.Add("Course Date (MMDDYY)", GetType(String))

 For i = 0 To dt.Columns.Count - 1
            dt.Columns(i).DefaultValue = ""
        Next

        grdCourse.DataSource = dt
        Dim ts As New DataGridTableStyle
        ts.MappingName = "CourseInfo"
        grdCourse.TableStyles.Clear()
        grdCourse.TableStyles.Add(ts)

        ts.GridColumnStyles(0).Width = 150
        ts.GridColumnStyles(1).Width = 170

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question