I am not new to programming but I am new to programming Windows controls. So let me ask the ultimate simple question. Beleive it or not, I have searched Help and a book or two and cant find a simple example.
I have data in an SQL file that is a double. I want to display it in a text box and allow the user to edit it. I want it to appear in the format 999,999.99 when the form is populated. If the user changes the number, as they leave the textbox, change to format of the new number to 999,999.99.
I do not want to use a MaskEdit control - I want a pure .Net solution.
I am filling the textbox like this:
PricetextBox.Text =prop.Price.ToString("N");
I need to put code in the PricetextBox_Validated event handler (or somewhere similar) that will put newly entered data in the same format.
I tried PricetextBox.Text = PricetextBox.Text.ToString("N") but the compiler choked.
In addition to an answer, I would also appreciate a link to some on line help in the entire text box input/output formatting area.
Thanks
I have data in an SQL file that is a double. I want to display it in a text box and allow the user to edit it. I want it to appear in the format 999,999.99 when the form is populated. If the user changes the number, as they leave the textbox, change to format of the new number to 999,999.99.
I do not want to use a MaskEdit control - I want a pure .Net solution.
I am filling the textbox like this:
PricetextBox.Text =prop.Price.ToString("N");
I need to put code in the PricetextBox_Validated event handler (or somewhere similar) that will put newly entered data in the same format.
I tried PricetextBox.Text = PricetextBox.Text.ToString("N") but the compiler choked.
In addition to an answer, I would also appreciate a link to some on line help in the entire text box input/output formatting area.
Thanks