Dim a As Single, a1 As Single, b As Single, b1 As Single
Dim c As Single, risultato As Single
Private Sub Cmdcalc_Click()
If Txta.Text <> "" And Txta1.Text <> "" And Txtb.Text <> "" And Txtb1.Text <> "" _
And Txtc.Text <> "" Then
If Txta.Text <> 0 And Txta1.Text <> 0 And Txtb.Text <> 0 And Txtb1.Text <> 0 _
And Txtc.Text <> 0 Then
a = CSng(Txta.Text)
a1 = CSng(Txta1.Text)
b = CSng(Txtb.Text)
b1 = CSng(Txtb1.Text)
c = CSng(Txtc.Text)
If a < b And a < c < b Then
risultato = ((b1 - a1) / (b - a)) * (c - a)
risultato = Round(risultato + a1, 2)
If a1 < risultato < b1 Then
Txtris.Text = risultato
Else
MsgBox "I parametri non sono corretti!!!", vbInformation, "Parametri errati"
End If
Else
MsgBox "I parametri non sono corretti!!!", vbInformation, "Parametri errati"
End If
End If
End If
End Sub
Private Sub cmdpul_Click()
Txta.Text = ""
Txta1.Text = ""
Txtb.Text = ""
Txtb1.Text = ""
Txtc.Text = ""
Txtris.Text = ""
End Sub
Private Sub Txta_Change()
If Not IsNumeric(Txta.Text) Then
Txta.Text = ""
End If
End Sub
Private Sub Txta1_Change()
If Not IsNumeric(Txta1.Text) Then
Txta1.Text = ""
End If
End Sub
Private Sub Txtb_Change()
If Not IsNumeric(Txtb.Text) Then
Txtb.Text = ""
End If
End Sub
Private Sub Txtb1_Change()
If Not IsNumeric(Txtb1.Text) Then
Txtb1.Text = ""
End If
End Sub
Private Sub Txtc_Change()
If Not IsNumeric(Txtc.Text) Then
Txtc.Text = ""
End If
End Sub