I have recently discovered a problem with some code I have been using. In the past, when I wanted to get a value of some item of some row within a dataview, I used the following syntax:
CurrentDataview.Table.Rows(RowNumberOfInterest).Item("PreviewCaption")
with the variable RowNumberOfInterest being the integer representing the row number of the dataview I wanted and "PreviewCaption" being the bound field name–
this seemed to work correctly and there were no syntax errors from the VS IDE, so I thought this was appropriate–besides, it was similar to code that I’ve used for datasets all along.
However, from time to time, I had unexplained results and eventually traced it back to this syntax.
After some research, I discovered the appropriate syntax seems to be the following:
CurrentDataview(CurrentPosition).Item("PreviewCaption")–just remove the Table.rows segment. This seems to correct the problems I was getting with the first version.
Am I the only one who confused this–is there any other background I should know–is the first syntax ever appropriate?
Thanks for any feedback and insight anyone can give me.
dale
CurrentDataview.Table.Rows(RowNumberOfInterest).Item("PreviewCaption")
with the variable RowNumberOfInterest being the integer representing the row number of the dataview I wanted and "PreviewCaption" being the bound field name–
this seemed to work correctly and there were no syntax errors from the VS IDE, so I thought this was appropriate–besides, it was similar to code that I’ve used for datasets all along.
However, from time to time, I had unexplained results and eventually traced it back to this syntax.
After some research, I discovered the appropriate syntax seems to be the following:
CurrentDataview(CurrentPosition).Item("PreviewCaption")–just remove the Table.rows segment. This seems to correct the problems I was getting with the first version.
Am I the only one who confused this–is there any other background I should know–is the first syntax ever appropriate?
Thanks for any feedback and insight anyone can give me.
dale