Questo è il codice del modulo
codice:
Public n As Integer
Public scadenza As String
Public allarme As String
Public nic As NOTIFYICONDATA ' per icona
Public Sub Main()
Form1.tray ' lancia la proc Tray per fissare Headle solo di FORM1
For numero = 0 To 100 ' apre tutte le note max 100
'If Not (apri) Then Exit For
apri (numero)
Next numero
n = n - 1
End Sub
Public Function apri(numero As Integer) As Boolean
Dim frm As New Form1
On Error GoTo erro
nome = App.Path & "\note\note" & numero & ".dat"
Open nome For Input As #1
' ********************* POSIZIONE ************************
Line Input #1, stringa
frm.Top = stringa
Line Input #1, stringa
frm.Left = stringa
Line Input #1, stringa
frm.Height = stringa
Line Input #1, stringa
frm.Width = stringa
frm.Tag = n
frm.Visible = True
' ***************** INIZIO TESTO ************************
Line Input #1, wave ' wave
Line Input #1, stringa ' data
frm.Label2.Caption = stringa
data_scad = stringa
Line Input #1, stringa ' prima riga
frm.Text1.Text = stringa
Do While Not EOF(1)
Line Input #1, stringa
frm.Text1.Text = frm.Text1.Text & Chr(13) & Chr(10) & stringa
Loop
Close #1
n = n + 1
' ****************** CONTROLLO SCADENZA *******************
If Len(data_scad) = 10 Then
If Date >= DateValue(data_scad) Then
frm.BackColor = &HFFFF&
frm.Text1.ForeColor = &HFF&
frm.Text1.BackColor = &HFFFF&
frm.Label2.BackColor = &HFFFF&
MsgBox "Nota " & numero & " scaduta!", vbInformation
End If
End If
apri = True
Exit Function
erro:
Close #1
apri = False
End Function
E questo è il codice nel form che crea un nuovo form
codice:
Private Sub save_Click()
If Me.Tag = "" Then
n = n + 1
Me.Tag = n
End If
nome = App.Path & "\note\note" & Me.Tag & ".dat"
Open nome For Output As #1
Print #1, Me.Top
Print #1, Me.Left
Print #1, Me.Height
Print #1, Me.Width
Print #1, Me.Label2.Caption
Print #1, Text1.Text
Close #1
End Sub