yvanrodrigues.com Forum Index yvanrodrigues.com
Welcome to my web site and blogs.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun Sep 05, 2010 9:11 pm
All times are GMT - 5 Hours
Forum index » My blogs » My Technical Blog
Windows Form not binding to DataRow
Post new topic   Reply to topic Page 1 of 1 [1 Post] View previous topic :: View next topic
Author Message
Yvan
Site Admin


Joined: 19 Mar 2005
Posts: 721

PostPosted: Wed Nov 16, 2005 7:11 pm    Post subject: Windows Form not binding to DataRow Reply with quote

I ran into this one which stumped me for a couple of days.

I had a valid DataSet that had been loaded with a DataRow by a mysqlDataAdapter.

I had a Windows Form that had several controls bound to the DataRow.

The controls were not binding (they showed their default values).

Eventually I discovered that I was able to force an exception with an error message that helped to explain what was actually going on.

Code:
this.BindingContext[this.FormData, "Orders"].ResumeBinding();


This generated the error

Quote:
An unhandled exception of type 'System.Exception' occurred in system.windows.forms.dll
Additional information: DataBinding could not find a row in the list that is suitable for all bindings


Something between the schema and the bound controls was not agreeing. I wasn't able to get a more specific error but I discovered the source of the problem by unbinding each of the controls and rebinding them gradually.

The problem was DateTimePicker controls that had their Value property bound to a DateTime field in the table.

The solution (workaround?) is to bind to the Text property instead of the Value property. This is not documented in the .NET platform SDK.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [1 Post] View previous topic :: View next topic
Forum index » My blogs » My Technical Blog
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.5429s ][ Queries: 9 (0.2206s) ][ Debug on ]