Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save NPS-ARCN-CAKN/1e845dfe3337eb9cd35d39b74512df90 to your computer and use it in GitHub Desktop.
Save NPS-ARCN-CAKN/1e845dfe3337eb9cd35d39b74512df90 to your computer and use it in GitHub Desktop.
VB .Net Set Up DataGridView Default Values
'https://msdn.microsoft.com/en-us/library/b22t666e(v=vs.110).aspx
Private Sub dataGridView1_DefaultValuesNeeded(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewRowEventArgs) _
Handles dataGridView1.DefaultValuesNeeded
With e.Row
.Cells("Region").Value = "WA"
.Cells("City").Value = "Redmond"
.Cells("PostalCode").Value = "98052-6399"
.Cells("Country").Value = "USA"
.Cells("CustomerID").Value = NewCustomerId()
End With
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment