You're here: Snippet Directory » Microsoft .NET (152)
Language:

Change File Informations

Language: English
Programming Language: VB.NET
Published by: Olaf [not registered]
Last Update: 5/4/2006
Views: 971

Description

Change file informations "Created at", "Modified at" and "Last Accessed at"

Code

1 Try 2 3 With Me.OpenFileDialog() 4 .Multiselect = False 5 .Filter = "All Files (*.*)|*.*" 6 .RestoreDirectory = True 7 .CheckFileExists = True 8 .CheckPathExists = True 9 .Title = "Choose a File" 10 .ShowDialog() 11 12 If .FileName <> "" Then 13 fi = New FileInfo(.FileName) 14 15 With fi 16 .CreationTimeUtc = CDate(Me.txtCreatedAt.Text) 17 .CreationTime = CDate(Me.txtCreatedAt.Text) 18 .LastWriteTimeUtc = CDate(Me.txtChangedAt.Text) 19 .LastWriteTime = CDate(Me.txtChangedAt.Text) 20 .LastAccessTimeUtc = CDate(Me.txtLastAccessed.Text) 21 .LastAccessTime = CDate(Me.txtLastAccessed.Text) 22 End With 23 24 MsgBox("Done!", MsgBoxStyle.Information, "Information") 25 End If 26 27 End With 28 29 Catch ex As Exception 30 31 MsgBox("Upps ...an error!" & vbCrLf & vbCrLf & ex.Message & " " & Err.Description, MsgBoxStyle.Critical, ex.Source) 32 33 End Try

One comment

1

It is possible to get and set the Archiv-Bit?

Wednesday, May 10, 2006 1:45:57 PM from memoryleak

Add a comment

Name *  

Email (won't be displayed) *    

Website  

Comment *  

Sicherheitscode Security Code *    

RSS