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.
Syncfusion Feedback

Numeric TextBoxes and NullString

Thread ID:

Created:

Updated:

Platform:

Replies:

53924 Dec 22,2006 02:36 PM UTC Jan 3,2007 02:36 AM UTC Windows Forms 7
loading
Tags: Tools
Josh Collins
Asked On December 22, 2006 02:36 PM UTC

We are currently using several of the numeric textboxes in conjunction with the NullString to display a '-' when the value is empty or zero.

We have a new requirement that null's should be handled differently from zeros. How can I change what value the textbox retains when the value is deleted? I would like to treat Double.MinValue (or some other large negative number) as the value set to DoubleValue when the control is emptied.

thanks

Gopalakrishnan S [Syncfusion]
Replied On December 22, 2006 06:47 PM UTC

Hi Josh,

Thanks for using Syncfusion products.

You could use KeyUp event of textbox for handling value of the textbox.

Here is code snippet:

private void integerTextBox1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyData==Keys.D0 && integerTextBox1.Text=="")
{
integerTextBox1.UseNullString=false;
integerTextBox1.Text="0";
}
else
integerTextBox1.UseNullString=true;
}

Sample.zip

Please let me know if this helps.

Best Regards,
S.Gopal.

Josh Collins
Replied On December 26, 2006 03:06 PM UTC

This doesn't accomplish what I'm looking for. Using the sample you attached. If I change the NullString = "-" in the Form1_Load then if I hit a zero then it remains a hyphen.

Gopalakrishnan S [Syncfusion]
Replied On December 26, 2006 03:51 PM UTC

Hi Josh,

Sorry for the inconvenience caused. Please change the condition statement in the keyUp event .
Here is the code snippet:
private void integerTextBox1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyData==Keys.D0 && integerTextBox1.Text=="-")
{

}
}

Please let me know if this works.
Thanks,
S.Gopal.

Josh Collins
Replied On December 27, 2006 08:22 PM UTC

There is still a problem that if you hit a zero in the box when UseNullString = true then the null string is immediately displayed rather than 0.0.

Gopalakrishnan S [Syncfusion]
Replied On December 29, 2006 12:36 AM UTC

Hi Josh,

We regret for the inconvenience caused. I am afraid, we were not able to reproduce the issue. Have you reproduced the issue using the sample.zip? Are you using different sample for this issue? Please send me the sample having the issue and with reproducing steps. This will help us to resolve the issue soon.

Sample.zip

Thanks,
S.Gopal.

Josh Collins
Replied On December 29, 2006 01:15 PM UTC

Yes, I can recreate it with your sample. Steps to recreate:
- Enter a value in one of the boxes.
- Then select all in the box and hit delete. '-' is now displayed.
- Then hit zero to enter a zero. It remains '-'.

I am using 4.1.0.58.

Gopalakrishnan S [Syncfusion]
Replied On January 3, 2007 02:36 AM UTC

Hi Josh,

Sorry for the delay in getting back to you. I have tested this issue with v4.1.0.58. But still I am not able to reproduce this issue. Here it works fine. I have also attached the video file that shows the execution.

Textbox_video.zip

Please let me know if I understand your requirement properly.

Thanks,
S.Gopal.

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.

Warning Icon 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.Close Icon

;