Solved

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

Posted on 2006-06-27
3
169 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 500 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

706 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now