Senin, 09 Februari 2009

How to do basic file I/O in Visual Basic 2005 or in Visual Basic .NET

SUMMARY
This step-by-step article shows you how to do six basic file input/output (I/O) operations in Microsoft Visual Basic 2005 or in Microsoft Visual Basic .NET. If you are new to .NET, you will find that the object model for file operations in .NET is similar to the FileSystemObject (FSO) that is popular with many Visual Studio 6.0 developers. To make the transition easier, the functionality that is demonstrated in this article is based on the following Microsoft Knowledge Base article:
186118 (http://support.microsoft.com/kb/186118/) How to use FileSystemObject with Visual Basic
You can still use the FileSystemObject in .NET. Because the FileSystemObject is a Component Object Model (COM) component, .NET requires that access to the object be through the Interop layer. .NET generates a wrapper for the component for you if you want to use it. However, the File, FileInfo, Directory, DirectoryInfo classes, and other related classes in the .NET Framework, offer functionality that is not available with the FSO, without the overhead of the Interop layer.

Requirements
The following list outlines the recommended hardware, software, network infrastructure, and service packs that you need: • Microsoft Windows Server 2003, Microsoft Windows 2000 Professional, Windows 2000 Server, Windows 2000 Advanced Server, or Microsoft Windows NT 4.0 Server
• Microsoft Visual Studio 2005 or Microsoft Visual Studio .NET
• Microsoft Visual Studio 2005 Software Development Kit (SDK) Quickstarts or Microsoft Visual Studio .NET SDK Quickstarts



View file information code

This sample code uses a FileInfo object to access a file's properties. Notepad.exe is used in this example. The properties appear in a ListBox control. Dim FileProps As FileInfo = New FileInfo(winDir & "\notepad.exe")
With Me.ListBox1.Items
.Clear()
.Add("File Name = " & FileProps.FullName)
.Add("Creation Time = " & FileProps.CreationTime)
.Add("Last Access Time = " & FileProps.LastAccessTime)
.Add("Last Write Time = " & FileProps.LastWriteTime)
.Add("Size = " & FileProps.Length)
End With
FileProps = Nothing

-------------------------------------------------
Related :
Barcode-string-encoderVbnet

Changing-backgroundcolor

Trik finding google

Directly-filling control

Date-time format vb2008

Finding google rank

Domain checker phps cript

Foreign key sql2005

Create-insert-tableadapter

Check datagrid

Hapus error handling vb2008

Function2 vb2008

Explorer vb2008

Buat splashscreen vb2008

Foundation in net30

Backup-database-SQL2008

Executing SQL SERVER

Data grid view attending