المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : [Windows Form with visual C#] - Problem with data conversion



C# Programming
11-05-2009, 09:30 AM
Hello to all, now I expose my problem:

I'm developing a program with Visual C# express to calculate the ratio of my radio-controlled model!
How do I enter the following input data:
Number of teeth of spur gear (int), internal ratio (float), and ratio that you want to get (float).
I need as output the number of teeth of the pinion to use. The pinion is obtained with the following formula:

Pinion = (Spur Gear * Ratio) / Internal Ratio

My problem is that I don' t know how to operate the data conversions, because obviously I can' t write:

Int SpurGear = textbox1.Text;
Float Ratio = textbox2.Text;
Float InternalRatio= textbox3.Text;
Float Pinion = (SpurGear * Ratio) / InternalRatio;
label1.text= Pinion;

Etc Etc

Someone can help me?