Can someone help me? How do I declare that my column 4 should accept integers only? Thanks. God Bless.

Hi!

Another approach could be using ColumnName instead of ColumnIndex:

Check this:

Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
        If DataGridView1.CurrentCell.OwningColumn.HeaderText = "CustID" Then
            If DataGridView1.CurrentCell.Value <> Nothing AndAlso Not IsNumeric(DataGridView1.CurrentCell.Value) Then
                MessageBox.Show("Please enter numeric value.")
            End If
        End If
    End Sub

    Private Sub DataGridView1_DataError(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles DataGridView1.DataError
        MessageBox.Show("Please enter numeric value.")
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.