kimprogrammer
Programmer
Hello
I have created a datagrid I've only choosen to display 4 of the columns from my database. They are PPstartDate, PayCode,Amount and Comments. The rest of the fields I will fill in when I go and update the database.
I have the following code(see below) and when I enter a line I get the following error from my messagebox "another error", when I display e.column I get 3 and e.context I get Commit.
So it looks like its telling me that there is problem with the comments column(this the user can enter or leave blank).
But when I comment out the code and let the datagrid error dialog box show the error it says Column EmpNum does not allow nulls. Which is a field on the database table but not displayed in the datagrid view
So I though I understood that e.columnIndex corresponded to the columns I'm displaying because the first three columns display corresponding indexes.
Could someone explain this to me.
Code;
------------------------------------
Private Sub SwipeAccumulativeHoursDataGridView_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles SwipeAccumulativeHoursDataGridView.DataError
' Select Case e.ColumnIndex
' Case 1 'needs paycode
' Debug.WriteLine("e.ColumnIndex")
' Debug.WriteLine(e.ColumnIndex)
' MessageBox.Show("Must enter Pay Code", "", MessageBoxButtons.OK, MessageBoxIcon.Error)
' Case 0 'Needs to be a datetime
' Debug.WriteLine("e.ColumnIndex")
' Debug.WriteLine(e.ColumnIndex)
' MessageBox.Show("Date - Must be a valid date", "", MessageBoxButtons.OK, MessageBoxIcon.Error)
' Case 2 'Needs to be a decimal
' Debug.WriteLine("e.columnindex")
' Debug.WriteLine(e.ColumnIndex)
' MessageBox.Show("Amount - Must enter a numeric field", "", MessageBoxButtons.OK, MessageBoxIcon.Error)
' Case Else
' Debug.WriteLine("e.ColumnIndex")
' Debug.WriteLine(e.ColumnIndex)
' Debug.WriteLine(e.Context)
' MessageBox.Show("another error", "", MessageBoxButtons.OK, MessageBoxIcon.Error)
' End Select
'End Sub
-----------------------------------------------
I have created a datagrid I've only choosen to display 4 of the columns from my database. They are PPstartDate, PayCode,Amount and Comments. The rest of the fields I will fill in when I go and update the database.
I have the following code(see below) and when I enter a line I get the following error from my messagebox "another error", when I display e.column I get 3 and e.context I get Commit.
So it looks like its telling me that there is problem with the comments column(this the user can enter or leave blank).
But when I comment out the code and let the datagrid error dialog box show the error it says Column EmpNum does not allow nulls. Which is a field on the database table but not displayed in the datagrid view
So I though I understood that e.columnIndex corresponded to the columns I'm displaying because the first three columns display corresponding indexes.
Could someone explain this to me.
Code;
------------------------------------
Private Sub SwipeAccumulativeHoursDataGridView_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles SwipeAccumulativeHoursDataGridView.DataError
' Select Case e.ColumnIndex
' Case 1 'needs paycode
' Debug.WriteLine("e.ColumnIndex")
' Debug.WriteLine(e.ColumnIndex)
' MessageBox.Show("Must enter Pay Code", "", MessageBoxButtons.OK, MessageBoxIcon.Error)
' Case 0 'Needs to be a datetime
' Debug.WriteLine("e.ColumnIndex")
' Debug.WriteLine(e.ColumnIndex)
' MessageBox.Show("Date - Must be a valid date", "", MessageBoxButtons.OK, MessageBoxIcon.Error)
' Case 2 'Needs to be a decimal
' Debug.WriteLine("e.columnindex")
' Debug.WriteLine(e.ColumnIndex)
' MessageBox.Show("Amount - Must enter a numeric field", "", MessageBoxButtons.OK, MessageBoxIcon.Error)
' Case Else
' Debug.WriteLine("e.ColumnIndex")
' Debug.WriteLine(e.ColumnIndex)
' Debug.WriteLine(e.Context)
' MessageBox.Show("another error", "", MessageBoxButtons.OK, MessageBoxIcon.Error)
' End Select
'End Sub
-----------------------------------------------