Hi I just started playing around with Visual Basics today and thought it would be cool if I could make a program to work out the weight and the price of a square peice of steel. I have tried to solve the problem and fixed many errors but now I'm stuck. The program give's me a total 0f zero all the time I need help.
This is the formula for the weight os the steel. Length x Width x thickness x 8.3 (rounded off Its not critical for this purpose) devided by 1000000 to get rid of the zero's. So a square plate 300mm x 300mm x 12mm x 8.3 / 100000 (this is just to get rid of all the zero's) =8.964 KG. This is the first total to get and for the program to show. The next is to multiply 8.964 x 12 (the price per Kg in My currency Rand) then the total cost sould be R107.568 for the peice of steel.
This is what ive done
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim num1, num2, num3, num4, num5, num6, product As Single, weight As Single
num1 = TextBox1.Text
num2 = TextBox2.Text
num3 = TextBox3.Text
num4 = TextBox4.Text
num5 = Val(8.3)
num6 = Val(1000000)
TextBox5.Text = product
TextBox6.Text = weight
weight = num1 * num2 * num3 * num5
product = weight * num4 / num6
End Sub
Like I said I'm new to this don't enven know if this is the right way to do this.
Any help would be appreciated.