Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' declare constants and variables
Dim cm As Integer
Dim m As Double
Dim g As Integer
Dim kg As Double
mtextbox.Text = ""
kgtextbox.Text = ""
' converting from cm to m
Integer.TryParse(cmTextBox.Text, cm)
m = cm / 100
' converting from g to kg
Integer.TryParse(gtextbox.Text, g)
kg = g / 1000
' display the converted result (cm to m)
If user enter integer then
display = "m"
Else
MessageBox.Show("Please enter a number.")
End If
' display the converted result (g to kg)
If user enter integer then
display = "kg"
Else
MessageBox.Show("Please enter a number.")
'set focus
mtextbox.Focus()
kgtextbox.Focus()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
cmtextbox.Text = ""
gtextbox.Text = ""
End Sub
End Class
My project topic is on data conversion for length and weight. There is something wrong with the code. Can anybody help me. Thanks in advance. I need to hand in on 22/1/10. Please reply asap.