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
Sconto - Form1.frm

Form1.frm

Caricato da: Albertking82
Scarica il programma completo

  1. Dim sconto As Single, valore As Single
  2. Dim i As Integer, j As Integer, num As Single, flag As Boolean
  3. Private Sub cmddel_Click()
  4.   Text1.Text = ""
  5.   Form1.Height = 1650
  6.   lblsconto.Caption = ""
  7.   Text1.SetFocus
  8. End Sub
  9.  
  10. Private Sub Command1_Click()
  11.  If Text1.Text <> "" Then
  12.    If IsNumeric(Text1.Text) Then
  13.      Form1.Height = 2535
  14.      num = CSng(Text1.Text)
  15.      sconto = CSng(Mid(Combo1.Text, 1, 2))
  16.     sconto = num * sconto / 100
  17.     valore = Round(num - sconto, 2)
  18.     lblsconto.Caption = "Il prezzo è : " & valore
  19.   Else
  20.    Text1.Text = ""
  21.    Text1.SetFocus
  22.   End If
  23.  Else
  24. Text1.Text = ""
  25. Text1.SetFocus
  26. End If
  27. End Sub
  28.  
  29. Private Sub Form_Load()
  30. Form1.Height = 1650
  31. j = -1
  32. For i = 10 To 95 Step 5
  33.  j = j + 1
  34.  Combo1.List(j) = i & "%"
  35. Next i
  36. Combo1.Text = "50%"
  37. End Sub
  38.  
  39. Private Sub Text1_Change()
  40.  If flag Then
  41.     flag = False
  42.     Text1.Text = ""
  43.  End If
  44. End Sub
  45.  
  46. Private Sub Text1_KeyPress(KeyAscii As Integer)
  47. If KeyAscii = Asc(",") Then
  48. Exit Sub
  49. End If
  50. If KeyAscii = 46 Or (KeyAscii < Asc("0") Or KeyAscii > Asc("9")) Then
  51. MsgBox "Input errato", vbInformation, "Errore"
  52. flag = True
  53. End If
  54. End Sub