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
Brain Albert - Form1.frm

Form1.frm

Caricato da: Albertking82
Scarica il programma completo

  1. Dim ris As Single, a As Integer, b As Integer, op As Integer
  2. Dim s As String, sfondo As Integer, backg As String
  3. Sub operazione(num As Integer)
  4.  Select Case num
  5.   Case 0
  6.    s = "+"
  7.    ris = a + b
  8.   Case 1
  9.    s = "-"
  10.    ris = a - b
  11.   Case 2
  12.    s = "x"
  13.    ris = a * b
  14.   Case 3
  15.    s = ":"
  16.    ris = a / b
  17.  End Select
  18.  lblop.Caption = s
  19. End Sub
  20.  
  21. Private Sub cmdcanc_Click()
  22. Txtc.Text = ""
  23. End Sub
  24.  
  25. Private Sub cmdinit_Click()
  26. Call Form_Load
  27. End Sub
  28.  
  29. Private Sub cmdok_Click()
  30. If Txtc.Text <> "" Then
  31.   If CSng(Txtc.Text) = ris Then
  32.    MsgBox "Il risultato è corretto", vbInformation, "Corretto"
  33.    Else
  34.    MsgBox "Sbagliato!!!!Il risultato corretto è " & ris, vbInformation, "Errato"
  35.    Txtc.Text = ris
  36.   End If
  37. End If
  38. End Sub
  39.  
  40. Private Sub Form_Load()
  41. Randomize
  42. a = 0
  43. b = 0
  44. c = 0
  45. Txta.Text = ""
  46. Txtb.Text = ""
  47. Txtc.Text = ""
  48. a = CSng(Rnd * 100)
  49. b = CSng((Rnd * 100) + 1)
  50. op = Int(Rnd * 4)
  51. Call operazione(op)
  52. sfondo = Int((Rnd * 6) + 1)
  53. backg = Trim(CStr(sfondo))
  54. Form1.Picture = LoadPicture(App.Path & "\" & backg & ".jpg")
  55. Txta.Text = a
  56. Txtb.Text = b
  57. End Sub
  58.  
  59. Private Sub Txtc_Change()
  60. If Not IsNumeric(Txtc.Text) Then
  61.    Txtc.Text = ""
  62.  End If
  63. End Sub