In a C# windows forms class I am binding my textboxes like this.
this.textMargin.DataBindings.Add(new Binding("Text", dt, "Margin", true, DataSourceUpdateMode.OnValidation, 0, "P"));
This is fine for displaying the textbox "textMargin" as a percent. But, when I pass the value of the text box to my update statement, I get a string format error even though I am trying to use Decimal.Parse like this:
decimal testconvert = Decimal.Parse(this.textMargin.Text);
The value I am trying to pass is '100%', but it needs to submit back to the database as 1.
What is the secret here?
Thanks