Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Interpolazione lineare - Form1.frm

Form1.frm

Caricato da: Albertking82
Scarica il programma completo

  1. Dim a As Single, a1 As Single, b As Single, b1 As Single
  2. Dim c As Single, risultato As Single
  3.  
  4. Private Sub Cmdcalc_Click()
  5. If Txta.Text <> "" And Txta1.Text <> "" And Txtb.Text <> "" And Txtb1.Text <> "" _
  6.     And Txtc.Text <> "" Then
  7.     If Txta.Text <> 0 And Txta1.Text <> 0 And Txtb.Text <> 0 And Txtb1.Text <> 0 _
  8.       And Txtc.Text <> 0 Then
  9.       a = CSng(Txta.Text)
  10.       a1 = CSng(Txta1.Text)
  11.       b = CSng(Txtb.Text)
  12.       b1 = CSng(Txtb1.Text)
  13.       c = CSng(Txtc.Text)
  14.       If a < b And a < c < b Then
  15.       risultato = ((b1 - a1) / (b - a)) * (c - a)
  16.       risultato = Round(risultato + a1, 2)
  17.        If a1 < risultato < b1 Then
  18.          Txtris.Text = risultato
  19.          Else
  20.           MsgBox "I parametri non sono corretti!!!", vbInformation, "Parametri errati"
  21.        End If
  22.        Else
  23.        MsgBox "I parametri non sono corretti!!!", vbInformation, "Parametri errati"
  24.       End If
  25.     End If
  26. End If
  27. End Sub
  28.  
  29. Private Sub cmdpul_Click()
  30. Txta.Text = ""
  31. Txta1.Text = ""
  32. Txtb.Text = ""
  33. Txtb1.Text = ""
  34. Txtc.Text = ""
  35. Txtris.Text = ""
  36. End Sub
  37.  
  38. Private Sub Txta_Change()
  39. If Not IsNumeric(Txta.Text) Then
  40.    Txta.Text = ""
  41. End If
  42. End Sub
  43.  
  44. Private Sub Txta1_Change()
  45. If Not IsNumeric(Txta1.Text) Then
  46.    Txta1.Text = ""
  47. End If
  48. End Sub
  49.  
  50. Private Sub Txtb_Change()
  51. If Not IsNumeric(Txtb.Text) Then
  52.    Txtb.Text = ""
  53. End If
  54. End Sub
  55.  
  56. Private Sub Txtb1_Change()
  57. If Not IsNumeric(Txtb1.Text) Then
  58.    Txtb1.Text = ""
  59. End If
  60. End Sub
  61.  
  62. Private Sub Txtc_Change()
  63. If Not IsNumeric(Txtc.Text) Then
  64.    Txtc.Text = ""
  65. End If
  66. End Sub