HighTechTalks DotNet Forums  

BindingSource Winforms to Business Object - Cannot leave text box

Dotnet Framework (WinForms DataBinding) microsoft.public.dotnet.framework.windowsforms.databinding


Discuss BindingSource Winforms to Business Object - Cannot leave text box in the Dotnet Framework (WinForms DataBinding) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
D-Someone
 
Posts: n/a

Default BindingSource Winforms to Business Object - Cannot leave text box - 01-03-2008 , 12:12 PM






I'm binding a text box to a Integer (Nullable) property of a business object.
If the user enters invalid data or even enteres nothing (example, just
leaves it blank) they cannot leave the field at all. Adding an ErrorProvider
gives me "Invalid Cast Exception" as the error. How can I allow the user to
leave the text box even if there is bad data in it? This is definatly not
desired functionality for me. I've tried putting code in the Validating and
LostFocs events and still have not had any luck. There are good reasons why
a user would not want to enter data into one of the bound text boxes and when
this occurs I'd like the business object property to be set to a value of
nothing/null. I;'ve tried that in code to by manually setting the BO
property to Nothing but the user still cannot exit the combo box.

What do I need to do to allow myself to bind a text box to a business object
and not have the user stuck in that text box if they erase the existing value
and put in no data (aka:empty string). Simply they need to be able to leave
the box and the databinding needs to accept the empty string returned from
the text box as a null/nothing value.

D.

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.