C-F code
- De variabelen
Dim c As Single
Dim f As Single
- Een procedure om F te berekenen
Sub berekenf()
f = c * 9 / 5 + 32
txtF.Text = f
End Sub
- Een procedure om C te berekenen
Sub berekenc()
c = (f - 32) * 5 / 9
txtC.Text = c
VScroll1.Value = c
End Sub
- We roepen de gepaste procedure(s) op als de gebruiker de waarde van de schuifbalk
verandert, of als de gebruiker entert in één van de tekstvakken.
Private Sub txtC_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Not IsNumeric(txtC.Text) Then
txtC.Text = ""
Exit Sub
End If
c = txtC.Text
berekenf
End If
End Sub
Private Sub txtF_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Not IsNumeric(txtF.Text) Then
txtF.Text = ""
Exit Sub
End If
f = txtF.Text
berekenc
VScroll1.Value = c
End If
End Sub
Private Sub VScroll1_Change()
c = VScroll1.Value
txtC.Text = c
berekenf
End Sub
[VB Web] - [hlrnet] - [copyright]