CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2006
    Posts
    449

    Setting Default value OR Null value in DataGridView

    I have a Databound DataGridView displayed in my form. I need to set the default value for some of the columns and when the user enters then that value had to be overwritten. How do I do that?

    I went to DataGridView - Edit column and checked the properties and in CellStyleBuilder I set the NullValue to 'False' for one of the CheckBox column but doesn't seem to have any impact. It's not reflecting in DB. Please help me out. Thank you!

    My working environment is: VS2005 / SQL / VB / Windowsapp.
    Thank you for your support.

    Best regards,
    Lax

  2. #2
    Join Date
    Oct 2005
    Location
    Islamabad, Pakistan
    Posts
    1,277

    Re: Setting Default value OR Null value in DataGridView

    try this
    Code:
            DataGridView1.Columns("ColumnName").DefaultCellStyle.NullValue = "Default Value"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured