Numeric TextBoxes and NullString
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
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
SIGN IN To post a reply.
7 Replies
GS
Gopalakrishnan S
Syncfusion Team
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.
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.
JC
Josh Collins
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.
GS
Gopalakrishnan S
Syncfusion Team
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.
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.
JC
Josh Collins
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.
GS
Gopalakrishnan S
Syncfusion Team
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.
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.
JC
Josh Collins
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.
- 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.
GS
Gopalakrishnan S
Syncfusion Team
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.
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.
SIGN IN To post a reply.
- 7 Replies
- 2 Participants
-
JC Josh Collins
- Dec 22, 2006 02:36 PM UTC
- Jan 3, 2007 02:36 AM UTC