Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class TempConClone
- Private ConType As Byte
- Private Sub TxtFocus(sender As TextBox, e As EventArgs) Handles C.GotFocus, F.GotFocus, K.GotFocus, R.GotFocus
- If sender Is C Then : ConType = 0
- ElseIf sender Is F Then : ConType = 1
- ElseIf sender Is K Then : ConType = 2
- ElseIf sender Is R Then : ConType = 3
- End If
- End Sub
- Private Sub TxtChanged(sender As TextBox, e As EventArgs) Handles C.TextChanged, F.TextChanged, K.TextChanged, R.TextChanged
- If Double.TryParse(sender.Text, Nothing) Then
- Select Case ConType
- Case 0 : F.Text = C.Text * 1.8 + 32 : K.Text = C.Text + 273.15 : R.Text = K.Text * (9 / 5)
- Case 1 : C.Text = (F.Text - 32) / 1.8 : K.Text = C.Text + 273.15 : R.Text = K.Text * (9 / 5)
- Case 2 : C.Text = K.Text - 273.15 : F.Text = C.Text * 1.8 + 32 : R.Text = K.Text * (9 / 5)
- Case 3 : K.Text = R.Text * (5 / 9) : C.Text = K.Text - 273.15 : F.Text = C.Text * 1.8 + 32
- End Select
- Else
- Select Case ConType
- Case 0 : F.Text = String.Empty : K.Text = String.Empty : R.Text = String.Empty
- Case 1 : C.Text = String.Empty : K.Text = String.Empty : R.Text = String.Empty
- Case 2 : C.Text = String.Empty : F.Text = String.Empty : R.Text = String.Empty
- Case 3 : C.Text = String.Empty : F.Text = String.Empty : K.Text = String.Empty
- End Select
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment