I am using VS2005 for vb.net. I am getting compile error at below statement. How to fix this?
For Each rw As DataRow In data.Rows
For Each dc As DataColumn In stringColumns
rw.Field(Of String)(dc).Replace("_x00D_", "") //Error showing here
Next
Next
Update 2: Up-vote the other more direct/clear answer 🙂
Update: while the following still applies, there is a
DataRow.Fieldprovided by the DataRowExtensions class; make sure it is referenced.Because there is no member called
Fielddefined over theDataRowtype… perhaps the specialItemproperty was meant instead?Note in the example where it is used as an indexer (
row("Name")). Neat, huh?(Also, something should be done with the result of the
Replaceas strings are immutable in .NET.)Happy coding.