.NET
  Home arrow .NET arrow Page 5 - Utilize the Full Functionality of the Whid...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

Utilize the Full Functionality of the Whidbey File Management
By: Benoyraj Baskaran
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 5
    2004-08-17

    Table of Contents:
  • Utilize the Full Functionality of the Whidbey File Management
  • Classes that Supports System.IO.namespace
  • More Classes and Public Methods
  • Public Methods with File Class
  • FileStream and Other Classes
  • IOException Class and Others
  • System.Security.Permissions
  • Mode, Share and Access of Files

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Utilize the Full Functionality of the Whidbey File Management - FileStream and Other Classes


    (Page 5 of 8 )

    13. The FileStream class supports to read, write, open and close the file management operations as well as it supports to manage the operating system file operations such as pipes, standard input and output.

    14. The FileSystemEventArgs class provides data for the directory events as shown below.

    Changed event handler fires the properties or security details such as size, system attributes, last write time, last access time, whenever a file is changed or updated.

    Created event handler fires whenever a directory or file created in a specified path.

    Deleted event handler fires whenever a file or directory is deleted from the specified path.

    15. The FileSystemInfo class supports the public methods which you can use for both files and directory in the specified path, which serving as the basis for two objects such as FileInfo and DirectoryInfo, which we understand from above.

    16. The FileSystemWatcher class allows to notify or fires any changes occurs in the file system or directory such as a file or directory changed, deleted or created.

    Figure 1 shows the NotifyFilter properties, that you can use to watch the notifications.

    Whidbey File Management

     Figure 1 NotifyFilter Properties

    Usage:

    ‘  Create a new FileSystemWatcher and its properties

    Try
     Dim objFileSystemWatcher as New _ FileSystemWatcher()
     
     ‘ Watch the notification for LastAccess and LastWrite, FileName, CrationTime and the renaming of files and directories
     objFileSystemWatcher.NotifyFilter= (NotifyFilters.LastWrite Or NotifyFilters.LastAccess Or NotifyFilters.FileName Or NotifyFilters.DirectoryName Or NotifyFilters.FileName Or NotifyFilters.CreationTime)

     ‘ Only watch doc files
     objFileSystemWatcher.Filter = “*.doc”

     ‘ Add event handlers
       
          AddHandler objFileSystemWatcher.Changed, AddressOf OnChanged
         
      AddHandler objFileSystemWatcher.Created, AddressOf OnCreated
         
      AddHandler objFileSystemWatcher.Deleted, AddressOf OnChanged
          AddHandler objFileSystemWatcher.Renamed, AddressOf OnChanged
     
     ‘ Begin watching event for changed, deleted, renamed and created
     objFileSystemWatcher.EnableRaisingEvents=True
        
        ' Define the event handlers.
        Private Shared Sub OnChanged(ByVal source As Object, ByVal e As FileSystemEventArgs)
            ' Specify what is done when a file is changed, created, or deleted.
            MessageBox.Show("File: " & e.FullPath & " " & e.ChangeType)
        End Sub

        Private Shared Sub OnCreated(ByVal source As Object, ByVal e As RenamedEventArgs)
            ' Specify what is done when a file is renamed.
            MessageBox.Show("File: {0} renamed to {1}", e.OldFullPath, e.FullPath)

    Catch
     MessageBox.Show(“Error in File Operation”)
    End Try

    More .NET Articles
    More By Benoyraj Baskaran


     

    .NET ARTICLES

    - Using CrystalReportViewer to Display Crystal...
    - Creating Summary .Net Crystal Reports
    - More on Commands, Input and the WPF
    - Grouping and Aggregating When Querying LINQ ...
    - Commands, Input and the WPF
    - Keyboard and Ink Input with WPF
    - Mouse Input and the WPF
    - Input with Windows Presentation Foundation
    - Introducing LINQ with XML and Databases
    - An Introduction to LINQ
    - Querying LINQ to SQL: Basics
    - Completing a Simple Storefront with LINQ
    - Knowing Your Environment: the System.Environ...
    - Creating the Home Page for a Simple Storefro...
    - LINQ Quickly with Language Integrated Queries

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT