PC Review


Reply
Thread Tools Rate Thread

Datagridview Calendar Column DBNull Error

 
 
=?Utf-8?B?QXJuZSBCZXJ1bGRzZW4=?=
Guest
Posts: n/a
 
      17th Feb 2007
I've inserted a Calendar Column in my Datagridview. It works fine except for
2 issues:

1. The date appears in the AddNew Row...I would rather it only activated
when a new row is added (or read of course)

2. If the user clicks on the Calendar Column first ...in the AddNew row...I
get a DBNull error...instead of a new row being added. Here's the affected
code:

Public Overrides Sub InitializeEditingControl(ByVal rowIndex As Integer,
ByVal initialFormattedValue As Object, ByVal dataGridViewCellStyle As
DataGridViewCellStyle)
' Set the value of the editing control to the current cell value.
MyBase.InitializeEditingControl(rowIndex, initialFormattedValue,
dataGridViewCellStyle)
Dim ctl As CalendarEditingControl =
TryCast(DataGridView.EditingControl, CalendarEditingControl)
ctl.Value = CDate(Me.Value)
End Sub

Any help would be appreciated.

Thanks Arne
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: The value for column 'x' in table 'x' is DBNull.... =?Utf-8?B?Y2NfY3Jhc2g=?= Microsoft VB .NET 0 10th Apr 2007 07:12 PM
Datagridview Calendar Column =?Utf-8?B?QXJuZSBCZXJ1bGRzZW4=?= Microsoft VB .NET 2 15th Feb 2007 03:06 PM
DataGridView Combobox column Error Greg Microsoft Dot NET Framework 2 28th Jul 2006 09:51 AM
DataGridView Combobox column Error Greg Microsoft C# .NET 2 28th Jul 2006 09:51 AM
datagridview, using calendar control selecting a date for column Bob Microsoft VB .NET 2 8th Jun 2006 01:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:45 AM.