1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Nom As String
Dim D As Date = Now
Dim Fich As String
Dim Ext As String
Fich = FileSystem.Dir("C:\transfert\tmp42*")
Ext = GetExtension("C:\transfert\" & Fich)
If TextBox1.Text = "" Then
MsgBox("Erreur : impossible de renommer votre fichier.")
Else
Nom = D.ToString("yyyy-MM-dd" & "_" & TextBox1.Text)
WebBrowser1.Stop()
My.Computer.FileSystem.RenameFile("C:\transfert\" & Fich, Nom & Ext)
Application.Exit()
End If
End Sub
Private Function GetExtension(ByVal path As String) As String
Return New System.IO.FileInfo(path).Extension
End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Fichier As String
Fichier = FileSystem.Dir("C:\transfert\tmp42*")
WebBrowser1.Navigate("C:\transfert\" & Fichier)
End Sub
End Class |