?
Solved

Bind a Textbox to a Datarow?

Posted on 2005-04-17
5
Medium Priority
?
3,441 Views
Last Modified: 2008-01-09
I want to bind a textbox to a datarow.  I tried:

txtStrNo.DataBindings.Add(New Binding("Text", drResult , "strStructureNo"))
and
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!)

Thanks.
0
Comment
Question by:gerrystrat
5 Comments
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13803143
Will this work?

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

Expert Comment

by:tusharashah
ID: 13803162
a bit modification on above syntax, get value like following:

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

drResult.Close

-tushar
0
 

Author Comment

by:gerrystrat
ID: 13805532
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.
0
 
LVL 26

Accepted Solution

by:
Rejojohny earned 1000 total points
ID: 13806449
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"))


0
 

Author Comment

by:gerrystrat
ID: 13806476
Ok, thanks.  I don't think you can bind it either.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month13 days, 8 hours left to enroll

750 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