Bind a Textbox to a Datarow?

Posted on 2005-04-17
Last Modified: 2008-01-09
I want to bind a textbox to a datarow.  I tried:

txtStrNo.DataBindings.Add(New Binding("Text", drResult , "strStructureNo"))
txtStrNo.DataBindings.Add("Text", drResult , "strStructureNo")

and I get a SystemArgumentException

By the way, I'm working in .NET Compact Framework 1.0 in VB (obviously!)

Question by:gerrystrat
    LVL 28

    Expert Comment

    Will this work?

    txtStrNo.Text = drResult["strStructureNo"].ToString()
    LVL 18

    Expert Comment

    a bit modification on above syntax, get value like following:

    While drResult.Read
        txtStrNo.Text = drResult("strStructureNo").ToString            'where strStructureNo is DataBase Field name



    Author Comment

    That will assign the value to the textbox, but it won't actually bund the textbox to the field, right?  Changes in the textbox won't be reflected in the datarow.
    LVL 26

    Accepted Solution

    i do not think u can bind a datarow .. u can bind a dataset or probably even a datatable. .

    ur code shoud be
    txtStrNo.DataBindings.Add(New Binding("Text", UrDataset , "UrDatatable.ColumnName"))

    The above statement will work .. the one below i am not too sure .. but u could give it a try
    txtStrNo.DataBindings.Add(New Binding("Text", UrDataTable, "ColumnName"))


    Author Comment

    Ok, thanks.  I don't think you can bind it either.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Flash ( has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    728 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

    22 Experts available now in Live!

    Get 1:1 Help Now