CurrentRow row status

  • Thread starter Thread starter gdeal1
  • Start date Start date
G

gdeal1

Guest
Hi Guys
I have a datatable which indicates which image is currently being displayed. In datagridView cell click event it checks this table and change the status along with changing the image. I have to store this datatable into sql save the current row status. My problem is when I export this datatable back to my datagridview, the cell click event doesnt read anymore the status of the images. I have tried dt.AcceptChanges, itd didnt help. dt.LoadChanges, it reads correctley the unchanged rows but it wont read the modified rows at the first cell click. any idea how to fix this ? appreciated

Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
If e.ColumnIndex = 1 Then
If bsData.Current IsNot Nothing Then
Dim CurrentRow As DataRow = CType(bsData.Current, DataRowView).Row

If CurrentRow.Field(Of String)("CurrentImageName") = "Image1" Then
DataGridView1.Item("CompanyStatusImage", DataGridView1.CurrentRow.Index).Value = MyIcons.Proof
CurrentRow.SetField(Of String)("CurrentImageName", "Image2")
Else
DataGridView1.Item("CompanyStatusImage", DataGridView1.CurrentRow.Index).Value = MyIcons.Blank
CurrentRow.SetField(Of String)("CurrentImageName", "Image1")
End If
End If
End If


gdeal++

Continue reading...
 


Write your reply...
Back
Top