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? 2 2953
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?
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?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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")...
|
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:
...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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.
...
|
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)...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
| |