Diference between row("Column name") and row.Item("Column name")

Hi All, I was wondering what is the difference between row(“Column name”) and row.Item(“Column name”) ? it seems that both do the same thing.

Thank you in advance.

There is no difference. Refer below:

"There’s absolutely no difference between the two. Item is the default property of the DataRow class so one is simply a shorthand for the other. Basically all classes that are a collection of items have a default property and its usually named Item. Coincidentally, you’re doing exactly the same thing else where in your code. This:
vb.net Code:


is just shorthand for this:
vb.net Code:


because Rows is a DataRowCollection and the default property for that type is Item too.

That said, it looks like you’re using a typed DataSet so you shouldn’t be using untyped DataRows anyway. In that case it should look something like this:
vb.net Code:

Dim dr As PersonRow = Me.MyDataSet.PERSON(0)
Dim ID As Integer = dr.PERSON_ID

That’s the whole point of using typed DataSets in the first place."

ref: [RESOLVED] DataRow("ColumnName") vs DataRow.Item("ColumnName") ???-VBForums

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.