Im trying to return the path of a saved word document. So im monitoring the directory for saved changes.

If i save a document called sheet.docx i get these results. How come its not displaying just the full path and dcoument? C:\Documents and Settings\Owner\Desktop\New Folder\Sheet.docx as this is the entry i need



here is my code

vb Code:
  1. Private Sub fswDocumentDirectoryMonitor_Changed(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles fswDocumentDirectoryMonitor.Changed
  2.         Debug_LogFileChanged(e.FullPath)
  3.     End Sub
  4.  
  5.     ''' <summary>
  6.     ''' Logs that a file has changed in the debug log list view.
  7.     ''' </summary>
  8.     ''' <param name="pathToFile">The path to the file that was changed.</param>
  9.     ''' <remarks>
  10.     ''' Assumes pathToFile is not null.
  11.     ''' </remarks>
  12.     Private Sub Debug_LogFileChanged(ByVal pathToFile As String)
  13.         Dim count As Integer = lbMonitorDebug.Items.Count + 1
  14.         Dim message As String = String.Format("{0}- {1}  Changed  {2}", count, DateTime.Now, pathToFile)
  15.         lbMonitorDebug.Items.Add(message)
  16.     End Sub
  17.  
  18.     Private Sub fswDocumentDirectoryMonitor_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs)
  19.         Debug_LogFileCreated(e.FullPath)
  20.         ReturnCreatedFileAfterPrompting(e.FullPath)
  21.     End Sub
  22.  
  23.     ''' <summary>
  24.     ''' Logs that a file was created in the debug list box.
  25.     ''' </summary>
  26.     ''' <param name="fullPath">The full path to the file.</param>
  27.     Private Sub Debug_LogFileCreated(ByVal fullPath As String)
  28.         Dim count As Integer = lbMonitorDebug.Items.Count + 1
  29.         Dim message As String = String.Format("{0}- {1}  Created  {2}", count, DateTime.Now, fullPath)
  30.         lbMonitorDebug.Items.Add(message)
  31.     End Sub
  32.  
  33.     Private Sub ReturnCreatedFileAfterPrompting(ByVal filePath As String)
  34.  
  35.         Dim createdFile As New System.IO.FileInfo(filePath)
  36.  
  37.         Select Case createdFile.Extension.ToLower()
  38.             ' TODO: [AW] Magic list
  39.             Case ".doc", ".docx",
  40.                 MessageBox.Show(createdFile.ToString)
  41.         End Select
  42.  
  43.     End Sub
  44.  
  45.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  46.         Try
  47.             fswDocumentDirectoryMonitor.IncludeSubdirectories = True
  48.         Catch ex As Exception
  49.             ' TODO: [AW] Swallows all exceptions
  50.             MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
  51.         End Try
  52.     End Sub
  53.  
  54.     ''' <summary>
  55.     ''' Toggles the state of the file system watcher.
  56.     ''' </summary>
  57.     Private Sub StartMonitorState()
  58.         Try
  59.  
  60.             If fswDocumentDirectoryMonitor.Path = "" Then
  61.  
  62.                 Dim message As String = "Please choose a directory to monitor"
  63.                 MessageBox.Show(message)
  64.                 Exit Sub
  65.             End If
  66.  
  67.             fswDocumentDirectoryMonitor.EnableRaisingEvents = True
  68.  
  69.         Catch ex As Exception
  70.             ' TODO: Swallows all exceptions
  71.             ' TODO: What errors are expected?
  72.             MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
  73.         End Try
  74.     End Sub