VB.NET Examples

ChilkatHOMEAndroid™Classic ASPCC++C#C# WinRTDelphi ActiveXDelphi DLLVisual FoxProJavaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerShellPythonRubySQL ServerUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET WinRTVBScript

VB.NET Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
PFX
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression
Misc

More Examples...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

Byte Array
VB.NET FTPS
System.IO

 

 

 

 

 

 

Read Random-Access Disk File Seek Read-Only File Sharing

Download: Chilkat .NET Assemblies

VB.NET source code showing how to open a disk file for random-access in read-only / share mode. Shows how to seek from file origin, current position, or end of file.

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

        ' Open an already-existing file for read-only.  Allow other
        ' processes to open the file while we have it open.
        Dim fs As New FileStream("test.dat", FileMode.Open, FileAccess.Read, FileShare.Read)

        ' Set the file pointer to 100 bytes from the beginning.
        fs.Seek(100, SeekOrigin.Begin)

        ' Set the file pointer to the end of file.
        ' There's no point in doing this when we open the file read-only.
        ' But if you are opening the file read-write, this may be something
        ' of interest.
        fs.Seek(0, SeekOrigin.End)

        ' Set the file pointer to 100 bytes beyond the current position.
        fs.Seek(100, SeekOrigin.Current)

        ' Set the file pointer to 100 bytes from the beginning.
        fs.Seek(100, SeekOrigin.Begin)

        ' Read 100 bytes at this position.
        Dim byteArray(100) As Byte
        Dim numBytesRead As Integer = fs.Read(byteArray, 0, 100)

        fs.Close()

    End Sub


 

© 2000-2013 Chilkat Software, Inc. All Rights Reserved.