472,785 Members | 1,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

DataBinding change notification problem...

Hi,

I have a DateTime picker control on a form. The datetime
picker control is data bound to a column in a DataTable.
Yes I know about bound DateTime pickers and DBNull and
etc. so no troubles with that stuff...

However, as somebody out there probably knows,
programmatically setting the DateTimePicker.Value property
to a new VALUE does NOT in itself constitute a CHANGE to
the DataBinding mechanism {control focus etc. are involved
in the decision to fire change notification}.

Well this is causing me grief! I have a situation where I
MUST programmatically change the DateTimePicker.Value
property and I need the change to ripple down to my
DataRow immediately.

Question: How can I FORCE DataBinding change events to
fire for one or more bound controls on my form?

--Richard
Nov 15 '05 #1
2 3787
Richard:

Just a suggestion: you could try to take it the other way. Instead of
trying to programmatically modify the value of the datetime picker and have
it ripple down to the datarow, you could modify the underlying data field,
and let it "ripple up" to the control.

The trick would be getting to the current row. I think that it would go
something like this (haven't tested, this code might need some adjustment or
syntax correction):

// get the databinding object for the value property
Binding theBinding = theDateTimePicker.DataBindings["Value"];

// Get the current row
// if the target is a data row, I _think_ that you are going to get back a
// DataRowView object, but I might be lying.
DataRowView rowView = (DataRowView)theBinding.BindingManagerBase.Current ;

// modify the value
rowView["TheColumnName"] = ANewDateTimeValue;


"Richard" <an*******@discussions.microsoft.com> wrote in message
news:ef****************************@phx.gbl...
Hi,

I have a DateTime picker control on a form. The datetime
picker control is data bound to a column in a DataTable.
Yes I know about bound DateTime pickers and DBNull and
etc. so no troubles with that stuff...

However, as somebody out there probably knows,
programmatically setting the DateTimePicker.Value property
to a new VALUE does NOT in itself constitute a CHANGE to
the DataBinding mechanism {control focus etc. are involved
in the decision to fire change notification}.

Well this is causing me grief! I have a situation where I
MUST programmatically change the DateTimePicker.Value
property and I need the change to ripple down to my
DataRow immediately.

Question: How can I FORCE DataBinding change events to
fire for one or more bound controls on my form?

--Richard

Nov 15 '05 #2
Hello,

I'm having difficulties with the same problem in combination with the
DBNull issue. Can you explain the following a bit more, please? Do you
even have a solution for the DBNull-problem that works with databinding?
However, as somebody out there probably knows,
programmatically setting the DateTimePicker.Value property
to a new VALUE does NOT in itself constitute a CHANGE to
the DataBinding mechanism {control focus etc. are involved
in the decision to fire change notification}.


thanks in advance
Frank

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #3

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

Similar topics

15
by: Tim Jarvis | last post by:
Hi, I have an object that I am binding to a text box, this object exposes a boolean field, and I have implemented a format event handler and a parse event handler for the binding object, where I...
4
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox),...
3
by: Kevin Swanson | last post by:
I'm writing what should be a very simple app against an Oracle database. The app has a number of user controls, any one of which is loaded into a main display page using the loadControl method,...
1
by: Dave A | last post by:
Hi, I am struggling with two way databinding in WinForms and the DataGridView. I am binding to business object classes (rather than datatables). If I have a collection of these business...
11
by: John J. Hughes II | last post by:
I have a DataGridView displaying data from a DataSet. To the right of that I have a custom user control which displays one of the data set fields. The custom user control is bound to the data set...
8
by: Dirk | last post by:
Hello, I have a problem to use databinding with my business layer classes. My data class does not have simple properties (string, int or datetime), instead, all my properties are objects of the...
7
by: Vlado Jasovic | last post by:
Hello, I'm using typed dataset for databinding to windows controls and I'm having some problems. I'm trying to move all business logic to datatable column_changing events and the problem that...
3
by: Mauro D. | last post by:
Hi, In my usercontrol I bind the BindingSource I pass via property to all the control inside the usercontrol. For example Control ctl=new TextBox(); ctl.DataBindings.Add("Text", binding,...
0
by: Czechtim | last post by:
Hello, I have problem with databinding. I created small application using structure that I need to demonstrate problem. I need to change content of label when changing content of property...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.