Dim i1 As Integer
Dim i2 As Integer
For i1 = 0 To Me.DataGridView5.Columns.Count - 1
For i2 = 0 To Me.DataGridView5.Rows.Count - 1
If String.IsNullOrEmpty(Me.DataGridView5.Item(i1, i2).Value) Then
MessageBox.Show("You must fill in all cells before you can save the data.", "Empty Cells", MessageBoxButtons.OK, MessageBoxIcon.Information)
DataGridView5.Rows(i1).Cells(i2).Style.BackColor = Color.Bisque 'Index was out of range. Must be non-negative and less than the size of the collection.
Exit Sub
'MessageBox.Show(String.Format("{0},{1}", i1, i2)
End If
Next
Next
sushilsth 0 Light Poster
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.