kimprogrammer
Programmer
Hello
I have a couple more problems with my datagridview. Of course this could be an easier process.
First
I can enter data in a row but when i try to enter another row the first row disappears/blank out. Is there something in the properties window that has to be set to allow the user to enter more than one row?
Secondly
when I select save from the binding navigator that was automatically set up when I dragged the datafile over as a datagrid the data does not get saved. When I follow the code it gets to the if statement "Me._keyscan_payrollDataSet.HasChanges" but then goes to end if - so it must not think HasChanges has been set.
Here is the code
Private Function Save()
Dim Saved As Boolean
If Me._keyscan_payrollDataSet.HasChanges Then
Try
Dim HoursAdd() As DataRow = Me._keyscan_payrollDataSet.SwipeAccumulativeHours.Select("", "", DataViewRowState.Added)
For x As Integer = 0 To HoursAdd.GetUpperBound(0)
With HoursAdd(x)
.Item("SwipeID") = "44"
.Item("EmpNum") = cboEmployee.Text
.Item("PPDay") = cboPPStart.Text
.Item("InputType") = 3
.Item("SupReasonCode") = ""
.Item("Userid") = Environment.UserName
.Item("Timestamp") = Now
End With
Next x
Me.SwipeAccumulativeHoursTableAdapter.Update(HoursAdd)
Saved = True
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End If
Return Saved
End Function
Thanks for your help
I have a couple more problems with my datagridview. Of course this could be an easier process.
First
I can enter data in a row but when i try to enter another row the first row disappears/blank out. Is there something in the properties window that has to be set to allow the user to enter more than one row?
Secondly
when I select save from the binding navigator that was automatically set up when I dragged the datafile over as a datagrid the data does not get saved. When I follow the code it gets to the if statement "Me._keyscan_payrollDataSet.HasChanges" but then goes to end if - so it must not think HasChanges has been set.
Here is the code
Private Function Save()
Dim Saved As Boolean
If Me._keyscan_payrollDataSet.HasChanges Then
Try
Dim HoursAdd() As DataRow = Me._keyscan_payrollDataSet.SwipeAccumulativeHours.Select("", "", DataViewRowState.Added)
For x As Integer = 0 To HoursAdd.GetUpperBound(0)
With HoursAdd(x)
.Item("SwipeID") = "44"
.Item("EmpNum") = cboEmployee.Text
.Item("PPDay") = cboPPStart.Text
.Item("InputType") = 3
.Item("SupReasonCode") = ""
.Item("Userid") = Environment.UserName
.Item("Timestamp") = Now
End With
Next x
Me.SwipeAccumulativeHoursTableAdapter.Update(HoursAdd)
Saved = True
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End If
Return Saved
End Function
Thanks for your help