Codice nel timer:
Dim natale As New Date(2010, 12, 25)
Dim giorni_rimanenti As TimeSpan
Dim adesso As Date = Now
giorni_rimanenti = natale.Subtract(adesso)
Label1.Text = giorni_rimanenti.Days
Public Class Form1
Dim NUMERO_INIZIALE As Integer = 10
Dim NUMERO_CORRENTE As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If NUMERO_CORRENTE <> 0 Then
NUMERO_CORRENTE -= 1
Label1.Text = NUMERO_CORRENTE
Else
MsgBox("Fine timer")
Timer1.Enabled = False
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = NUMERO_INIZIALE
NUMERO_CORRENTE = NUMERO_INIZIALE
End Sub
End Class
Module Module1
Sub Main()
For Each filecorrente As String In My.Computer.FileSystem.GetFiles(My.Computer.FileSystem.SpecialDirectories.MyDocuments, FileIO.SearchOption.SearchTopLevelOnly)
Console.WriteLine(filecorrente)
Next
'per non far chiudere l'applicazione
Console.ReadLine()
End Sub
End Module
Module Module1
Sub Main()
For Each filecorrente As String In My.Computer.FileSystem.GetFiles(My.Computer.FileSystem.SpecialDirectories.MyDocuments, FileIO.SearchOption.SearchTopLevelOnly)
'in questo caso elenca solo il nome del file
Console.WriteLine(My.Computer.FileSystem.GetName(filecorrente))
Next
'per non far chiudere l'applicazione
Console.ReadLine()
End Sub
End Module
