C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » .NET Framework »

Project for Beginers: File Handling Utility


Posted Date: 17 Jan 2007    Resource Type: Articles    Category: .NET Framework
Author: Nirmala GMember Level: Bronze    
Rating: 1 out of 5Points: 10



File Handling Utility is developed to perform file functionalities in a simpler way so that most of the manual work can be reduced




Requirements


?H/W Platform: PENTIUM IV
?S/W Environment: WINDOWS XP
?Appln. Type: VB.NET


Features


1.Basic file functionalities like copying a file from one location to another, moving a file from one location to another location, renaming a file by fetching the path, deleting a file from the particular location.

2. Find and Replace gets a word or a letter as input and gets the replacing text as another input. While clicking the replace button the file is opened using the stream Reader and reads the file contents and searches for the text specified in the find. Stream writer replaces the text specified in find with the replacing text and writes into a file

3. Changing the File attributes functionality displays a browser button to get the file name along with the path and displays the attributes like file size, Creation Date and Time of the file. User can change the File access as Read only. The read only property does not allow the user to update any information in the file. Compression of the file can be done by selecting the compression check box and applying the attribute to the selected file.

4. Converting all characters to Upper case or Lower case based on the User needs.

5. Duplication Remover gets the files to be compared as input data and compares the file when the check button I clicked. If the file contents are same it indicates the files are identical and removes the one duplicate file by getting a confirmation message from us.



Summary


This tool has been designed so that it reduces most of the manual navigating to the path and making changes in the filenames and file contents

Code for File Copy



 


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try

FileCopy(TextBox1.Text, TextBox2.Text & "\" & source.Substring(source.LastIndexOf("\") + 1))
If TextBox2.Text = "" Then
MsgBox("Select the Location to Copy")
Else
MsgBox("File Copied Successfully")
Call clear()
Me.Hide()
Mainform.Show()
End If

Catch ex1 As IOException
MessageBox.Show("Select a different location to copy", ex1.GetType.ToString, MessageBoxButtons.OK, MessageBoxIcon.Information)
TextBox2.Text = ""

Catch Ex As Exception
MessageBox.Show("File Not Selected", Ex.GetType.ToString, MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try

End Sub




Code for File Move






Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try

Dim str1 As String
Dim str2 As String

str1 = Path.GetDirectoryName(TextBox1.Text)
str2 = Path.GetFullPath(TextBox2.Text)

If str1 = str2 Then
MsgBox("Select a different location to move")
TextBox2.Text = ""
Else

File.Move(TextBox1.Text, TextBox2.Text & "\" & source.Substring(source.LastIndexOf("\") + 1))

MsgBox("File moved successfully")
Call clear()
Me.Hide()
Mainform.Show()
End If

Catch ex As Exception
MessageBox.Show(ex.Message, ex.GetType.ToString, MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub








Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Utility  .  File Handling  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Easy way for exporting large volume of data ( not formatted data ) to excel using VB .Net
Previous Resource: Making your class clonable.
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use