By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,186 Members | 1,530 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,186 IT Pros & Developers. It's quick & easy.

Save Data Question

P: n/a
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
Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
-----Original Message-----
Hi,

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

Thanks
.

Nov 15 '05 #2

P: n/a

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.

Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.