access dataview elements by name

Posted on 2005-04-06
Last Modified: 2010-04-23
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!

Question by:PapaSmurf
    LVL 27

    Accepted Solution

    Hi Ben:
    Try the following:

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


    Author Comment

    Thanks Dabas, spot on.

    I was soooo close......

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now