Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-06-27
3
Medium Priority
?
176 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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 …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
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…

715 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