Click here to Skip to main content
15,888,984 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Can anyone Direct me to how to change Windows 'Settings' programmatically? Pin
Dave Kreskowiak18-Jul-18 10:37
mveDave Kreskowiak18-Jul-18 10:37 
GeneralRe: Can anyone Direct me to how to change Windows 'Settings' programmatically? Pin
Member 331739318-Jul-18 11:29
Member 331739318-Jul-18 11:29 
GeneralRe: Can anyone Direct me to how to change Windows 'Settings' programmatically? Pin
Mycroft Holmes18-Jul-18 14:16
professionalMycroft Holmes18-Jul-18 14:16 
QuestionUSING FSWATCHER TO MONITOR FILES COPIED TO ALL EXTERNAL DRIVES Pin
Member 1390609010-Jul-18 22:55
Member 1390609010-Jul-18 22:55 
AnswerRe: USING FSWATCHER TO MONITOR FILES COPIED TO ALL EXTERNAL DRIVES Pin
Jochen Arndt10-Jul-18 23:49
professionalJochen Arndt10-Jul-18 23:49 
GeneralRe: USING FSWATCHER TO MONITOR FILES COPIED TO ALL EXTERNAL DRIVES Pin
Member 1390609011-Jul-18 0:15
Member 1390609011-Jul-18 0:15 
GeneralRe: USING FSWATCHER TO MONITOR FILES COPIED TO ALL EXTERNAL DRIVES Pin
Jochen Arndt11-Jul-18 0:35
professionalJochen Arndt11-Jul-18 0:35 
GeneralRe: USING FSWATCHER TO MONITOR FILES COPIED TO ALL EXTERNAL DRIVES Pin
Member 1390609011-Jul-18 4:07
Member 1390609011-Jul-18 4:07 
This is what I have done ,am not sure if it's what you had in mind
Imports System.IO
Imports System.Diagnostics
Public Class Form1
Public watchfolder As FileSystemWatcher
Public watchers As New List(Of FileSystemWatcher)()



Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btn_startwatch.Click
Dim drives As String() = System.IO.Directory.GetLogicalDrives()
Dim watchfolder = New System.IO.FileSystemWatcher()
Dim i As Integer = 0
For Each strDrive As String In drives
Dim df As New DriveInfo(strDrive)
If Not df.IsReady Then
Continue For
End If
watchfolder.Path = strDrive
watchers.Add(watchfolder)
watchfolder.NotifyFilter = IO.NotifyFilters.DirectoryName
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.FileName
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.Attributes
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.CreationTime
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.LastAccess
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.Security
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.LastWrite
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.Size
AddHandler watchfolder.Changed, AddressOf logchange
AddHandler watchfolder.Created, AddressOf logchange
AddHandler watchfolder.Deleted, AddressOf logchange
AddHandler watchfolder.Renamed, AddressOf logrename

watchfolder.EnableRaisingEvents = True
btn_startwatch.Enabled = False
btn_stop.Enabled = True


Next
End Sub
Private Sub logchange(ByVal source As Object, ByVal e As System.IO.FileSystemEventArgs)
If e.ChangeType = IO.WatcherChangeTypes.Changed Then
folderactivity.Text &= "file" & e.FullPath & "has been modified" & vbCrLf
End If
If e.ChangeType = IO.WatcherChangeTypes.Created Then
folderactivity.Text &= "file" & e.FullPath & "has been created" & vbCrLf
End If
If e.ChangeType = IO.WatcherChangeTypes.Deleted Then
folderactivity.Text &= "file" & e.FullPath & "has been deleted" & vbCrLf
End If

End Sub
Private Sub logrename(ByVal source As Object, ByVal e As System.IO.RenamedEventArgs)

folderactivity.Text &= "file" & e.OldName & "has been renamed to" & e.Name & vbCrLf

End Sub

Private Sub btn_stop_Click(sender As Object, e As EventArgs) Handles btn_stop.Click
For Each watchfolder In watchers
watchfolder.EnableRaisingEvents = False
btn_startwatch.Enabled = True
btn_stop.Enabled = False
Next
End Sub
End Class
GeneralRe: USING FSWATCHER TO MONITOR FILES COPIED TO ALL EXTERNAL DRIVES Pin
Jochen Arndt11-Jul-18 7:06
professionalJochen Arndt11-Jul-18 7:06 
AnswerRe: USING FSWATCHER TO MONITOR FILES COPIED TO ALL EXTERNAL DRIVES Pin
Dave Kreskowiak11-Jul-18 3:18
mveDave Kreskowiak11-Jul-18 3:18 
GeneralRe: USING FSWATCHER TO MONITOR FILES COPIED TO ALL EXTERNAL DRIVES Pin
Member 1390609011-Jul-18 4:06
Member 1390609011-Jul-18 4:06 
GeneralRe: USING FSWATCHER TO MONITOR FILES COPIED TO ALL EXTERNAL DRIVES Pin
Dave Kreskowiak11-Jul-18 5:14
mveDave Kreskowiak11-Jul-18 5:14 
AnswerRe: USING FSWATCHER TO MONITOR FILES COPIED TO ALL EXTERNAL DRIVES Pin
mo149211-Jul-18 5:55
mo149211-Jul-18 5:55 
GeneralRe: USING FSWATCHER TO MONITOR FILES COPIED TO ALL EXTERNAL DRIVES Pin
Eddy Vluggen13-Jul-18 0:51
professionalEddy Vluggen13-Jul-18 0:51 
QuestionVisual Basic Codes 6.0 Pin
Asheeledio5-Jul-18 23:32
Asheeledio5-Jul-18 23:32 
AnswerRe: Visual Basic Codes 6.0 Pin
Richard MacCutchan5-Jul-18 23:36
mveRichard MacCutchan5-Jul-18 23:36 
AnswerRe: Visual Basic Codes 6.0 Pin
Chris Quinn5-Jul-18 23:41
Chris Quinn5-Jul-18 23:41 
AnswerRe: Visual Basic Codes 6.0 Pin
Dave Kreskowiak6-Jul-18 13:48
mveDave Kreskowiak6-Jul-18 13:48 
Questioncan't connect to finger print scanning device from windows server 2003 Pin
Meax5-Jul-18 0:36
Meax5-Jul-18 0:36 
AnswerRe: can't connect to finger print scanning device from windows server 2003 Pin
Richard Deeming5-Jul-18 1:38
mveRichard Deeming5-Jul-18 1:38 
GeneralRe: can't connect to finger print scanning device from windows server 2003 Pin
Meax5-Jul-18 8:06
Meax5-Jul-18 8:06 
Questionhow to highlight dates of Month Calendar from database windows form Pin
Meax2-Jul-18 20:01
Meax2-Jul-18 20:01 
AnswerRe: how to highlight dates of Month Calendar from database windows form Pin
Richard MacCutchan2-Jul-18 21:08
mveRichard MacCutchan2-Jul-18 21:08 
GeneralRe: how to highlight dates of Month Calendar from database windows form Pin
Meax2-Jul-18 22:19
Meax2-Jul-18 22:19 
GeneralRe: how to highlight dates of Month Calendar from database windows form Pin
Richard MacCutchan2-Jul-18 22:20
mveRichard MacCutchan2-Jul-18 22:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.