Jumat, 06 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



List disk drives code

This sample code uses the Directory and Drive classes to list the logical drives on a system. For this sample, the results appear in a ListBox control. Dim dirInfo As Directory
Dim drive As String
Me.ListBox1.Items.Clear()
Dim drives() As String = dirInfo.GetLogicalDrives()
For Each drive In drives
Me.ListBox1.Items.Add(drive)
Next


-------------------------------------
Related:

Trik vb.net2008 code

basic io explorer vb2005

checking if files exist vb2005

Connecting passworded server another domain

Connecting reading from excel VBnet

copy files created between date

Copy Picture from Database

list disk drive vb2005

list file in vb2005

list sub forlder vb2005

Load exe file run from memory

move diferrent location vb2005

network connections VisualBasic2005

open multiple image no OpenFileDialog

play audio files VisualBasic2005

read file vb2005

sqlserver2005-security

view information vb2005

write file in vb2005