Save Data Question

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

Hi,

I have a winform app where users enters in data. The data is comprised of
options (strings), values (doubles) and so on. I am trying to pass this
data to a class which will be used as a container class. How do I pass
values (double) that are entered in textboxes since they are text? Should I
use System.Convert? Or should I save the data as strings and then when the
data is needed convert to double using System.Convert?

Thanks
 
You can use System.Convert or Double.Parse to convert the
string.

You should definitely convert on the way in and store as
a double. Otherwise, you have no way of validating the
value before it is stored.

Charlie
 
Hi Sam,

Based on my understanding, you got the user input data from textbox, and
want to pass it to the container class(such as form class).
Actually, you get the textbox's content as string(TextBox.Text property),
then for string of double value, you can use Convert.ToDouble to convert
the string to double type.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top