Please excuse me, i appreciate this is somewhat elementary.
XAML.CS
Double D;
D = Convert.ToInt32(Diameter.Text);
D = int.Parse(Diameter.Text);
Double R;
R = (D / 2);
Double A;
A = (R * R * (Math.PI));
Double M;
M = Convert.ToInt32(Mass.Text);
M = int.Parse(Mass.Text);
float g;
g = 9.81f;
float P;
P = Convert.ToInt32(Pressure.Text);
P = int.Parse(Pressure.Text);
float Ol1;
Ol1 = Convert.ToInt32(OilLevel.Text);
Ol1 = int.Parse(OilLevel.Text);
Double V1;
V1 = ((Math.PI) * R * R * Ol1);
float K1;
K1 = Convert.ToInt32(SpringRate.Text);
K1 = int.Parse(SpringRate.Text);
Double Pr1;
Pr1 = Convert.ToInt32(InitialPreload.Text);
Pr1 = Convert.ToInt32(Preload.Text);
Pr1 = (Convert.ToInt32(InitialPreload.Text) + Convert.ToInt32(Preload.Text));
InitializeComponent();
Line two (D = Convert.ToInt32(Diameter.Text)) throws the error.
Below is the xaml code which holds the text box's
XAML
<StackPanel>
<TextBlock Margin = "10 10" Text="Spring Force Calculator" HorizontalAlignment="Center" FontWeight="Bold" FontSize="22"/>
<TextBlock Margin = "10 10" Text="Mass - Kg" FontSize="18"/>
<TextBox x:Name="Mass" Margin="10 10" Text="165"/>
<TextBlock Margin = "10 10" Text="Initial Pressure - Bar" FontSize="18"/>
<TextBox x:Name="Pressure" Margin="10 10" Text="1"/>
<TextBlock Margin = "10 10" Text="Internal Fork Diameter - mm" FontSize="18"/>
<TextBox x:Name="Diameter" Margin="10 10" Text="46"/>
<TextBlock Margin = "10 10" Text="Internal Fork Area - mm²" FontSize="18"/>
<TextBox x:Name="Area" Margin="10 10"/>
<TextBlock Margin = "10 10" Text="Spring Rate - N/m" FontSize="18"/>
<TextBox x:Name="SpringRate" Margin="10 10" Text="9"/>
<TextBlock Margin = "10 10" Text="Installed Preload - mm" FontSize="18"/>
<TextBox x:Name="InitialPreload" Margin="10 10" Text="10"/>
<TextBlock Margin = "10 10" Text="Preload - mm" FontSize="18"/>
<TextBox x:Name="Preload" Margin="10 10" Text="6"/>
<TextBlock Margin = "10 10" Text="Oil Level - mm" FontSize="18"/>
<TextBox x:Name="OilLevel" Margin="10 10" Text=".133"/>
<TextBlock Margin = "10 10" Text="Maximum Allowable Travel - mm" FontSize="18"/>
<TextBox x:Name="MaxATravel" Margin="10 10" Text="115"/>
<TextBlock Margin = "10 10" Text="Maximum Calculated Travel - mm" FontSize="18"/>
<TextBox x:Name="MaxCTravel" Margin="10 10"/>
</StackPanel>
I know i must be missing something basic and rather obvious to the trained eye. I should note that this is my first attempt at programming and trying to learn as i build (maybe not the best idea).
Sorry again for the beginner question, please help!
Thanks Jord