access dataview elements by name

I currently have a Dataview that returns a single row (after applying a rowfilter). I can access the fields with Dataview1(0)(n) and this works fine.

I'd much rather access the fields by column name to make changing the code in future easier, but I can't figure out how.

Any suggestions welcome!

Ben
PapaSmurfAsked:
Who is Participating?
 
DabasCommented:
Hi Ben:
Try the following:

        Dim dr As DataRowView = DataView1.Item(0)
        TextBox1.Text = dr.Item("FieldName").ToString

Dabas
0
 
PapaSmurfAuthor Commented:
Thanks Dabas, spot on.

I was soooo close......
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.