DataGridView DefaultValuesNeeded Failure

stevecking

Active member
Joined
Dec 27, 2006
Messages
32
Programming Experience
5-10
According to documentation, when a row is added to the DataGridView you can use the DefaultValuesNeeded event to populate values of the row that are needed. I've a foreign key and a date value that seem to fail. I stop the process during debugging to inspect the values used to populate the columns and then the .Value of he column. While the values used to populate the columns are good they do not seem to be assigned to the e.Rows.Columns("ColumnName").Value property as it is 'nothing' and the row is not added. The names have been verified so the syntax should be correct and no exceptions are reported. Any help would be appreciated.
VB.NET:
Private Sub TblPpr_MilestonesDataGridView_DefaultValuesNeeded(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewRowEventArgs) Handles TblPpr_MilestonesDataGridView.DefaultValuesNeeded
    With e.Row
        .Cells("PprIDTextBoxColumn").Value = dbInteger(Me.txtPprID.Text)
        .Cells("ChgDateTextBoxColumn").Value = dbDateTime(Date.Today)
    End With
End Sub
 
Last edited by a moderator:
I just tested a similar scenario and it worked fine. I can't tell you why it's not working for you, but as an alternative you could handle the AddingNew event of your BindingSource instead.
 
Back
Top