473,378 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

DataBindings

i have a form with a couple of textboxes bound to a collectionbase object.
The code looks like this:

txtName.DataBindings.Add(new Binding("Text", instrumentSet, "Name"));

txtComment.DataBindings.Add(new Binding("Text", instrumentSet, "Comment"));

Maybe I'm looking at things the wrong way but intuitively I'd think that the
binding goes both ways. That is, when I change the text in the textbox it
should automatically change the contents of the object it's bound too. I
know it'd be easy to update the source with an OnChanged event but somehow I
get the feeling that I might be doing something wrong. Can somebody clue me
in here?
Nov 16 '05 #1
2 2948
Chuck,

It should. Does the object that is exposed by the collection base have
a writable Name and Comment property? If they are read-only, then nothing
is updated.

Can you show the collection class as well?

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Chuck Bowling" <ch**********@sbcglobal-NO-SPAM.net> wrote in message
news:u0**************@TK2MSFTNGP14.phx.gbl...
i have a form with a couple of textboxes bound to a collectionbase object.
The code looks like this:

txtName.DataBindings.Add(new Binding("Text", instrumentSet, "Name"));

txtComment.DataBindings.Add(new Binding("Text", instrumentSet,
"Comment"));

Maybe I'm looking at things the wrong way but intuitively I'd think that
the binding goes both ways. That is, when I change the text in the textbox
it should automatically change the contents of the object it's bound too.
I know it'd be easy to update the source with an OnChanged event but
somehow I get the feeling that I might be doing something wrong. Can
somebody clue me in here?

Nov 16 '05 #2
Whoops... stupid me... no set property... ty...

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ut**************@TK2MSFTNGP10.phx.gbl...
Chuck,

It should. Does the object that is exposed by the collection base have
a writable Name and Comment property? If they are read-only, then nothing
is updated.

Can you show the collection class as well?

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Chuck Bowling" <ch**********@sbcglobal-NO-SPAM.net> wrote in message
news:u0**************@TK2MSFTNGP14.phx.gbl...
i have a form with a couple of textboxes bound to a collectionbase object.
The code looks like this:

txtName.DataBindings.Add(new Binding("Text", instrumentSet, "Name"));

txtComment.DataBindings.Add(new Binding("Text", instrumentSet,
"Comment"));

Maybe I'm looking at things the wrong way but intuitively I'd think that
the binding goes both ways. That is, when I change the text in the
textbox it should automatically change the contents of the object it's
bound too. I know it'd be easy to update the source with an OnChanged
event but somehow I get the feeling that I might be doing something
wrong. Can somebody clue me in here?


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: akadiri4 | last post by:
I am trying to bind a textbox to a dataset using VB.Net but it doesn't seem to work Here is the code: DS = New DataSet DA = New SqlDataAdapter(StrSQL, StrConn) DA.Fill(DS, "StrSQL")...
0
by: Richard | last post by:
Hi, I am trying to bind a datetime picker control to a column in a DataView and I get this exception: "Object reference not set to an instance of an object." Pseudo code looks like this: ...
0
by: Kyle Rowe | last post by:
Binding binding = new Binding("Text", x, null); textBox1.DataBindings.Add(binding); I wrote the aboe code when the form loads, but when I change the variable x, the textbox does not display the...
0
by: Johann Blake | last post by:
I have a form with textboxes that are bound to a dataset. The dataset contains two tables and some of the textboxes use data from one table while other textboxes use data from the other table. I...
9
by: HAN(removethis)twister | last post by:
I've tried to create 11 textboxes as variables (not actually visible in the program, not in Windows Form Designer) and have set DataBindings to the text properties of the TextBoxes BUT according to...
6
by: Graham Blandford | last post by:
Hi all, I haven't received any replies to a previous question I posted regarding problems I was having with databound textboxes.. so I'll try a different angle... Can anyone point me in the...
2
by: C Glenn | last post by:
This is admitedly vague. But so is my understanding of the problem. I'm using this chunk of code: retControl.DataBindings.Add(ctrlBinding.PropertyName,DataSource,BindingField); This resolves...
0
by: XenReborn | last post by:
Ok this should be simple. I made a form, added a combobox (for selecting items to edit, not for updating fields), several textboxes, a few checkboxes etc. On formshow it connects to my database,...
2
by: marcf | last post by:
Hi everyone, I've just studio using VS2008 and have a quick question regarding databindings, i'm fairly handy with vb6 so this question really relates to good practice rather than actual coding. ...
1
by: janj | last post by:
Hi all, I'm having a problem binding two object properties to properties of another object. The code below works as expected when only one binding is added but doesn't work at all (still compiles)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.