By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,899 Members | 1,137 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,899 IT Pros & Developers. It's quick & easy.

Exception during DataBindings.Add()

P: n/a
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:

timePicker.DataBindings.Clear();
timePicker.DataBindings.Add("Value", dv,
TimeColumn.ColumnName);

In the debugger I can see that the view is valid and that
there IS a row of data in the DataView which is
initialized to reasonable values. I can also see that the
ColumnName IS correct and that the column does exist in
the view. I'm not passing anything null into this method
call and yet the call throws a null exception; any ideas?

The method call throws the exception from deep within the
bowels of the framework. Here's a stack trace:

<<Object reference not set to an instance of an object.>>
at
System.ComponentModel.ReflectPropertyDescriptor.Se tValue
(Object component, Object value)
at System.Windows.Forms.Binding.SetPropValue(Object
value)
at System.Windows.Forms.Binding.PushData()
at System.Windows.Forms.Binding.UpdateIsBinding()
at System.Windows.Forms.Binding.CheckBinding()
at System.Windows.Forms.Binding.SetListManager
(BindingManagerBase bindingManagerBase)
at
System.Windows.Forms.ListManagerBindingsCollection .AddCore
(Binding dataBinding)
at System.Windows.Forms.BindingsCollection.Add(Bindin g
binding)
at System.Windows.Forms.BindingContext.UpdateBinding
(BindingContext newBindingContext, Binding binding)
at System.Windows.Forms.Binding.SetControl(Control
value)
at
System.Windows.Forms.ControlBindingsCollection.Add Core
(Binding dataBinding)
at System.Windows.Forms.ControlBindingsCollection.Add
(Binding binding)
at System.Windows.Forms.ControlBindingsCollection.Add
(String propertyName, Object dataSource, String dataMember)
at
<<...Application code from here to end of trace...>>

Nov 15 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.