We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

IntegerTextBox binding

Thread ID:

Created:

Updated:

Platform:

Replies:

42579 Apr 1,2006 06:26 PM Jun 7,2006 04:42 PM Windows Forms 15
loading
Tags: Tools
Mark Atkinson
Asked On April 1, 2006 06:26 PM

What''s the best way to bind a DataView to an IntegerTextBox? If I do this: DataBindings.Add ("BindableValue", dataView, fieldName); Then, I''m able to bind to the dataView when the value happens to be DBNull which is handy and necessary but something seems to be happening during validation and the underlying dataset never seems to detect a change. Are there any tricks to binding to the BindableValue property? If I do this: DataBindings.Add ("IntegerValue", dataView, fieldName); I can change data and things work until I bind to a value that happens to be DBNull. Then I get an exception with the message: "Object cannot be cast from DBNull to other types." So, it seems like the BindableValue is the property to bind to but am I missing something? Thanks in advance, Mark

Anupama Roy [Syncfusion]
Replied On April 3, 2006 08:14 AM

Hi Mark, Are you using Essential Studio version 4.1? In 4.1,there is a known issue related to this.Please let me know so that I can give you more information based on this. Thanks for choosing Syncfusion. Regards, Anu.

Administrator [Syncfusion]
Replied On April 3, 2006 10:29 AM

Hi Anu, Yes, I''m using 4.1. Would the same issue exist for PercentTextBox, DoubleTextBox? Thanks for the reply, Mark > >Hi Mark, > >Are you using Essential Studio version 4.1? In 4.1,there is a known issue related to this.Please let me know so that I can give you more information based on this. > >Thanks for choosing Syncfusion. > >Regards, > >Anu. >

Anupama Roy [Syncfusion]
Replied On April 4, 2006 09:29 AM

Hi, Could you please set NumberGroupSeparator to String.Empty and see whether your exception is thrown or not.Also please let me know whether you have set UseNullString as true. Thanks, Anu.

Mark Atkinson
Replied On April 6, 2006 04:07 PM

Hi Anu, I changed the NumberGroupSeperator to String.Empty and I still get the same result when binding to the BindableValue property. An exception doesn''t get thrown, rather the value doesn''t get set in the underlying dataset. I also tested using the UseNullString value set as false and true: same result. I''ll try binding to the IntegerValue and see if there''s any difference. > >Hi, > >Could you please set NumberGroupSeparator to String.Empty and see whether your exception is thrown or not.Also please let me know whether you have set UseNullString as true. > >Thanks, > >Anu. > >

Anupama Roy [Syncfusion]
Replied On April 7, 2006 09:24 AM

Hi Mark, I am including a sample that has Databinding done with all our TextBox controls including IntegerTextBox and it worked fine with my suite. Could you please run this at your end and let me know how it goes?I have included the mdb file along the project sample Thanks, Anu.

Mark Atkinson
Replied On April 13, 2006 01:59 PM

Hi Anu, Thanks for the suggestions and source code. Binding to the IntegerValue (and setting those other properties) worked well initially until I needed to do something like this: DataBindings[dataView].SuspendBinding(); dataView.RowFilter = GetFilter(); DataBindings[dataView].ResumeBinding(); ...then, if the underlying data in the current row in the dataview had an integer field whose value is DBNull then exceptions were thrown. Recently I started using the new .NET BindingSource class and when I do some filtering and synching on the dataView that the BindingSource is bound to I get the same kinds of exceptions when I then do this: bindingSource.ResetBindings (false); ...the exception I get is: "DataBinding cannot find a row in the list that is suitable for all bindings". Again, if I change the binding property from IntegerValue to BindableValue then I have the issue of not being able to commit the changed value to the underlying data. I think I have an idea what is happening - the data really wants to be bound to an "integer-able" value. It''s almost as if the binding from the source to the control should be BindableValue, but the binding from the control to the source should be IntegerValue. Mark >Hi Mark, > >I am including a sample that has Databinding done with all our TextBox controls including IntegerTextBox and it worked fine with my suite. >Could you please run this at your end and let me know how it goes?I have included the mdb file along the project > >sample > > >Thanks, > >Anu. >

Anupama Roy [Syncfusion]
Replied On April 17, 2006 08:55 AM

Hi Mark, Sorry for the delay in response. I will investigate on integerTextBox issue and let you know about this.Do you see the same issue with other TextBoxes also? Please let me know regarding this. Thanks for your interest in Syncfusion products. Regards, Anu.

Anupama Roy [Syncfusion]
Replied On April 17, 2006 09:53 AM

Hi Mark, I tried the following code inorder to reproduce the issue. this.BindingContext[view].SuspendBinding (); this.view.RowFilter= "Amount =''8''"; this.BindingContext[view].ResumeBinding (); Could you please clarify where exacatly you mention your codings with respect to my previous sample.It would be appreciable if you can modify the previous sample and update us. Sorry for any inconvienience caused. Regards, Anu.

Mark Atkinson
Replied On April 21, 2006 06:22 PM

It''s really the same problem again. In the code you sent me, the field that''s bound to the IntegerTextBox control always has a value. In fact, the field in the database has a default value. As soon as one of those values is null (DBNull) your code will throw an exception ("Object cannot be cast from DBNull to other types.") so binding to the IntegerValue in the code you sent will work as long as all the rows in the table for that field have non-null values. I made some modifications to the mdb file (added some rows and got rid of the default value in the Amount field) and you can try it with the sample app. I really need to be able to bind to null values but how effective is the BindableValue property? > >Hi Mark, > >I tried the following code inorder to reproduce the issue. > >this.BindingContext[view].SuspendBinding (); >this.view.RowFilter= "Amount =''8''"; >this.BindingContext[view].ResumeBinding (); > >Could you please clarify where exacatly you mention your codings with respect to my previous sample.It would be appreciable if you can modify the previous sample and update us. > >Sorry for any inconvienience caused. > >Regards, > >Anu. > >

CurrencyDataBinding0.zip

Anupama Roy [Syncfusion]
Replied On April 24, 2006 09:45 AM

Hi Mark, Sorry for the confusion. You need to set BindableValue property itself in your scenario.Also you should set UseNullString property to true as shown below. this.integerTextBox1.DataBindings.Add ("BindableValue",view ,"Amount"); this.integerTextBox1.UseNullString =true; this.integerTextBox1.NullString=""; But in your version (4.1), we have a bug that when UseNullString property is used, IntegerTextBox will not be allowing values to be entered . This issue is resolved internally and the fix for this will be included with our upcoming release 4.2 due in another few days. For now you can test the above given codings for a DoubleTextBox and see whether the issue is resolved or not. Sorry for any inconvienience caused and Thank you for your patience. Regards, Anu.

Mark Atkinson
Replied On April 24, 2006 12:03 PM

Thanks Anu! I appreciate the feedback on this issue.

Mark Atkinson
Replied On May 23, 2006 10:55 AM

I didn''t see a note of this in the list of 4.2 features and fixes, but has this issue been resolved for 4.2? Thanks, Mark >Thanks Anu! >I appreciate the feedback on this issue.

Anupama Roy [Syncfusion]
Replied On May 26, 2006 05:52 AM

Hi Mark, In release notes it has been mentioned under IntegerTextbox Category - Fixes Thanks, Anu. >I didn''t see a note of this in the list of 4.2 features and fixes, but has this issue been resolved for 4.2? > >Thanks, >Mark > >>Thanks Anu! >>I appreciate the feedback on this issue.

Administrator [Syncfusion]
Replied On June 7, 2006 02:28 PM

OK, I have the latest Syncfusion 4.2 libraries and I''m still having great difficulty binding the BindableValue property of an IntegerTextBox to an integer field in a DataView. I have these properties set: NullString = ""; UseNullString = true; ...and I''m doing this type of binding: DataBindings.Add ("BindableValue", dataView, "MyIntField"); When I type a new value into the IntegerTextBox and then set focus in another control and have a look at the controls Validated event handler, I can see that the controls text is correct but the data source hasn''t been updated. So, when I move to a different record and then back again, the IntegerTextBox displays the old value - the new value never seems to get updated - as if using BindableValue only allows one way binding to the control. I''ll see if I can''t create a small project to send to you. >Hi Mark, > >In release notes it has been mentioned under IntegerTextbox Category - Fixes > >Thanks, > >Anu. > > > >>I didn''t see a note of this in the list of 4.2 features and fixes, but has this issue been resolved for 4.2? >> >>Thanks, >>Mark >> >>>Thanks Anu! >>>I appreciate the feedback on this issue.

Administrator [Syncfusion]
Replied On June 7, 2006 04:42 PM

I created a simple project and was able to reproduce my issue. The basic issue is the trouble with binding an IntegerTextBox''s BindableValue property. In the attached zip file, you can grab the small project I made and see that when the value is changed in the IntegerTextBox that uses the BindableValue to bind with, that the value never really gets changed. you can change that value and then click on some record in the grid, click back to the original record and the value is back to the original. This doesn''t happen when the IntegerValue property is bound. However, the IntegerValue has the obvious problem of not being able to bind to values of DBNull. >OK, I have the latest Syncfusion 4.2 libraries and I''m still having great difficulty binding the BindableValue property of an IntegerTextBox to an integer field in a DataView. > >I have these properties set: >NullString = ""; >UseNullString = true; > >...and I''m doing this type of binding: >DataBindings.Add ("BindableValue", dataView, "MyIntField"); > >When I type a new value into the IntegerTextBox and then set focus in another control and have a look at the controls Validated event handler, I can see that the controls text is correct but the data source hasn''t been updated. So, when I move to a different record and then back again, the IntegerTextBox displays the old value - the new value never seems to get updated - as if using BindableValue only allows one way binding to the control. > >I''ll see if I can''t create a small project to send to you. > > >>Hi Mark, >> >>In release notes it has been mentioned under IntegerTextbox Category - Fixes >> >>Thanks, >> >>Anu. >> >> >> >>>I didn''t see a note of this in the list of 4.2 features and fixes, but has this issue been resolved for 4.2? >>> >>>Thanks, >>>Mark >>> >>>>Thanks Anu! >>>>I appreciate the feedback on this issue.

intbinding.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;