|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
typed DataRowHi, I'm using VS2003 C#
I'd like to use a typed dataRow in an iteration by using the TableRow property of the Dataset so that I can use the instance to directly access the col. for example: foreach (dsmyDataSet.myTableRow tr in dsmyDataSet.myTable) { TreeNode myNode = new TreeNode(tr.RowCol); } I get an error saying it denotes a field where a class was expected. Isn't the 'myTableRow' a class? How can I do this? Many thanks for input in advance Ant It looks like you're using an instance type for the row. Instead of using
the instance, use the Type. Show quote "Ant" <A**@discussions.microsoft.com> wrote in message news:63A4DBC8-4F8A-4EB4-BBE6-F1AF846B1B02@microsoft.com... > Hi, I'm using VS2003 C# > > I'd like to use a typed dataRow in an iteration by using the TableRow > property of the Dataset so that I can use the instance to directly access > the > col. for example: > > foreach (dsmyDataSet.myTableRow tr in dsmyDataSet.myTable) > { > TreeNode myNode = new TreeNode(tr.RowCol); > } > > I get an error saying it denotes a field where a class was expected. Isn't > the 'myTableRow' a class? > > How can I do this? > > Many thanks for input in advance > Ant Thank you. You were right.
Show quote "W.G. Ryan eMVP" wrote: > It looks like you're using an instance type for the row. Instead of using > the instance, use the Type. > "Ant" <A**@discussions.microsoft.com> wrote in message > news:63A4DBC8-4F8A-4EB4-BBE6-F1AF846B1B02@microsoft.com... > > Hi, I'm using VS2003 C# > > > > I'd like to use a typed dataRow in an iteration by using the TableRow > > property of the Dataset so that I can use the instance to directly access > > the > > col. for example: > > > > foreach (dsmyDataSet.myTableRow tr in dsmyDataSet.myTable) > > { > > TreeNode myNode = new TreeNode(tr.RowCol); > > } > > > > I get an error saying it denotes a field where a class was expected. Isn't > > the 'myTableRow' a class? > > > > How can I do this? > > > > Many thanks for input in advance > > Ant > > > ;-) Glad I could be of help.
Show quote "Ant" <A**@discussions.microsoft.com> wrote in message news:980815EE-9511-41A0-9694-D0027BADCB57@microsoft.com... > Thank you. You were right. > > "W.G. Ryan eMVP" wrote: > >> It looks like you're using an instance type for the row. Instead of >> using >> the instance, use the Type. >> "Ant" <A**@discussions.microsoft.com> wrote in message >> news:63A4DBC8-4F8A-4EB4-BBE6-F1AF846B1B02@microsoft.com... >> > Hi, I'm using VS2003 C# >> > >> > I'd like to use a typed dataRow in an iteration by using the TableRow >> > property of the Dataset so that I can use the instance to directly >> > access >> > the >> > col. for example: >> > >> > foreach (dsmyDataSet.myTableRow tr in dsmyDataSet.myTable) >> > { >> > TreeNode myNode = new TreeNode(tr.RowCol); >> > } >> > >> > I get an error saying it denotes a field where a class was expected. >> > Isn't >> > the 'myTableRow' a class? >> > >> > How can I do this? >> > >> > Many thanks for input in advance >> > Ant >> >> >> |
|||||||||||||||||||||||