LISTATO 1  La soluzione dell'esercizio proposto nello scorso numero

Private Sub btnSalva_Click()

  Dim Numero1 As Integer

  Dim Numero2 As Integer

  Dim Numero3 As Integer

  Dim Stringa As String

  Open "archivio.dat" For Output As #1

    Numero1 = Int(Val(txtNum1.Text))

    Numero2 = Int(Val(txtNum2.Text))

    Numero3 = Int(Val(txtNum3.Text))

    Stringa = txtStringa.Text

    Print #1, Numero1

    Print #1, Numero2

    Print #1, Numero3

    Print #1, Stringa

  Close #1

End Sub



Private Sub btnCarica_Click()

  Dim Numero1 As String

  Dim Numero2 As String

  Dim Numero3 As String

  Dim Stringa As String

  Open "archivio.dat" For Input As #1

  If Not EOF(1) Then

    Line Input #1, Numero1

    Line Input #1, Numero2

    Line Input #1, Numero3

    Line Input #1, Stringa

    txtNum1.Text = Numero1

    txtNum2.Text = Numero2

    txtNum3.Text = Numero3

    txtStringa.Text = Stringa

  End If

  Close #1

End Sub