Problem with DataGridView formatting and default values

G

Guest

I am rather unfamiliar with the DataGridView. I am trying to do a project
with VS2005 and SQL Server 2000. Assuming a DataGridView bound to a table,
what is the best place (best event) to catch new records and supply default
values? (Also assume that several of these fields do not permit nulls.)
 
K

Kevin S Gallagher

The event is "DefaultValuesNeeded"

Example:
Private Sub DgViewAllCustomers_DefaultValuesNeeded(ByVal sender As Object,
ByVal e As System.Windows.Forms.DataGridViewRowEventArgs) Handles
DgViewAllCustomers.DefaultValuesNeeded
If ToggleUsingDefaultRowValue Then
e.Row.Cells("FirstName").Value = "Required"
e.Row.Cells("LastName").Value = "Can not be blank"
e.Row.Cells("SomeDate").Value = Today
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top