Hi,
I have a grid and window form controls using VB .Net. I uaed as much of the wizards as I could to elminate lots of coding.
The user selects the row in the grid they want to edit and it displays the rest of the form to edit. Simple.
I used the following code. Its works except when the user sorts a field in the grid. Then the Me.BindingContext(Pending01_DS1, "Listing").Position
does not match the row that was selected from the grid.
The Binding Context position indicates row 36, but the row that was selected (clicked on) is 15. They are out of sync. If I sort by the org seq the position is correct again.
Dim iAddCurrRow As Integer
iAddCurrRow = Me.BindingContext(Pending01_DS1, "Listing").Position
Debug Code=================
MessageBox.Show(CStr(Me.Pending01_DS1.Tables("Listing").Rows(iAddCurrRow).Item("OurListing")) & "...." & CStr(Me.Pending01_DS1.Tables("Listing").Rows(iAddCurrRow).Item("FileNum")), "OurListing...", MessageBoxButtons.OK)
Debug Code================
Dim bOurListing As Boolean
bOurListing = CBool(Pending01_DS1.Tables("Listing").Rows(iAddCurrRow).Item("OurListing"))
If bOurListing Then
EnableOutsideListingControls()
EnableListingReferralControls()
Else
DisableOutsideListingControls()
DisableListingReferralControls()
End If
The above enables the wrong controls because it is not the right row in the bindingcontext....
However it displays the right row in the form controls to edit......................
I am in a real pickle as I have coded all my app this way and I did not noticed the problem until today.
Me.BindingContext(Pending01_Ds1, "Listing").EndCurrentEdit()
Me.SqlDaBuyer.Update(Pending01_Ds1, "Listing")
What do I need to do???????????????????????
Thanks
Roland
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only