473,399 Members | 3,401 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,399 software developers and data experts.

Binding same column to multiple properties

Hi,

Let's say I bind the same column to multiple properties of one control (or
even to the same property of several controls).

If a user changes the value of the property in one control - I would like to
take that value, and put it in the data source, and have anything else bound
to this column get updated with the new value.

However, called EndCurrentEdit, resets the value to the original, and
basically throws out the new value.

If however, I updated the value in all the other controls/properties bound
to this column, to the new value just entered - only then does
EndCurrentEdit put the new value into the datasource.

What I need is to have EndCurrentEdit accept the value and put it in the
datasource, so that then I can call Refresh, to have anything else bound to
the column receive the new value. If I have to put the value in myself in
every control bound to the column, that seems to defeat the purpose.

How can this be done?

Nov 20 '05 #1
5 1496
Hi Marina,

I am not sure if I understand your question (Because it is you I think it is
not an easy question), however did you already see what using different
dataviews can do for you, that I used with success.

(You should look in the adonet group, Jon (he tested somehing and now) is
completly to the other side (ours) about dispose in my opinion)

Cor
Nov 20 '05 #2
Here is the thing:

If I have 2 controls, each with a textbox. I bind the same column to each of
the textbox's Text properties. Then everything works as expected.

However, if one of the properties is another property (say a custom
property), then suddenly calling EndCurrentEdit does not work.

This is a very dynamic form, and I do not know which control with which
property will get bound to what. Because of that, i would need a separate
dataview for each binding - which has got to be expensive.

It seems to come down to the name of the property. As long as both
properties are the Text property, then it's all fine. If one of the
properties is a custom property I wrote, then changing the value of the
column in the Text property and calling EndCurrentEdit, discards the
changes, instead of sending them back to the datasource.

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Oo*************@TK2MSFTNGP09.phx.gbl...
Hi Marina,

I am not sure if I understand your question (Because it is you I think it is not an easy question), however did you already see what using different
dataviews can do for you, that I used with success.

(You should look in the adonet group, Jon (he tested somehing and now) is
completly to the other side (ours) about dispose in my opinion)

Cor

Nov 20 '05 #3
Hi Marina,

I think there is to much to gues in it for me, did you ever see that strange
behaviour of binding the text property from a combobox, your problem sounds
the same for me.

I never succeeded in getting a real answer on that, that did solve or
workaround the problem.

Cor
Nov 20 '05 #4
No, sorry, this is really completely different. When you are talking about a
combox, you are talking about changing the position of the current row -
this isn't what i am doing at all, this is all on the same row.

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:eb****************@TK2MSFTNGP12.phx.gbl...
Hi Marina,

I think there is to much to gues in it for me, did you ever see that strange behaviour of binding the text property from a combobox, your problem sounds the same for me.

I never succeeded in getting a real answer on that, that did solve or
workaround the problem.

Cor

Nov 20 '05 #5
Hi Marina,

This does work in my opinion fine.
(I places some buttons in your code to test it)

Cor

\\\
Dim dt As New DataTable
Dim dv1 As DataView
Dim dv2 As DataView
Private Sub Form2_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
dt.Columns.Add("MyColumn")
Dim row As DataRow = dt.NewRow
row(0) = "TestValue"
dt.Rows.Add(row)
dv1 = New DataView(dt)
dv2 = New DataView(dt)
MyTextBox1.DataBindings.Add("Text", dv1, "MyColumn")
MyTextBox1.DataBindings.Add("MyProperty", dv2, "MyColumn")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
MyTextBox1.Text = "TextValue"
Me.BindingContext(dv1).EndCurrentEdit()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
MyTextBox1.MyProperty = "PropValue"
Me.BindingContext(dv2).EndCurrentEdit()
End Sub
////
Nov 20 '05 #6

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

Similar topics

1
by: Marcin Floryan | last post by:
Hello! My question regards opening (and re-opening) Form and the Load event. I have a main form (frmMain) and I also have a data form (frmData). In the main form I have created: Private...
9
by: Marina | last post by:
Here is the problem. If 2 different properties on the same (or different) control are bound to the same data column, changing the Text property and calling EndCurrentEdit discards the new value. ...
1
by: JD Kronicz | last post by:
Hi .. I have an issue I have been beating my head against the wall on for some time. I am trying to use late binding for MS graph so that my end users don't have to worry about having the right...
0
by: Dextor | last post by:
I was hoping someone else could confirm this to be a bug in the new 1.1 framework when binding to a combo box. Here is the low down: When using the Oracle DataAdapter to return a query and fill a...
5
by: K | last post by:
I created a collection which is derived from ArrayList and implements IBindingList and ITypedList. Then I bound the DataSource of a data grid into the collection. It could show up the data but...
0
by: GrumpyDev | last post by:
Hi. My question is regarding binding a DataSet to a DataGrid. When I change Caption property of all column in my dataset and then bind dataset to a DataGrid, new caption aren't displayed in a grid...
3
by: Daniel M | last post by:
I'm building a medium-scale data-entry web application, which involves creating data entry forms, record listings and detail screens for lots of database tables. Rather than designing a series...
1
by: Demetri | last post by:
Someone posted the following back in June and I am now doing the same thing. I'll just paste what was asked and see if anyone can give us an answer: ...
0
by: aarnan | last post by:
I have two SqlDataSources that use two different stored procedures that take parameters to populate two controls, one dependant on an element of the other. The first data source,...
0
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
0
BarryA
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...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
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 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.