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
Write a text file code
This sample code uses a StreamWriter class to create and write to a file. If you have an existing file, you can open it in the same way. Dim writer As StreamWriter = _
New StreamWriter("c:\KBTest.txt")
writer.WriteLine("File created using StreamWriter class.")
writer.Close()
-------------------------------------------------
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
Tidak ada komentar:
Posting Komentar