Sample code for 30+ languages & platforms
VB.NET

Split File into Chunks

Demonstrates how to split a file into chunks.

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim fac As New Chilkat.FileAccess

' Any type of file may be split.  It doesn't matter if it's
' a binary file or a text file.
Dim fileToSplit As String = "qa_data/hamlet.xml"

Dim partPrefix As String = "hamlet"
Dim partExtension As String = "part"
Dim maxChunkSize As Integer = 50000
Dim destDirPath As String = "qa_output"

' Splits hamlet.xml into hamlet1.part, hamlet2.part, ...
' Output files are written to the current working directory.
' Each chunk will be 50000 bytes except for the last which
' will be the remainder.
success = fac.SplitFile(fileToSplit,partPrefix,partExtension,maxChunkSize,destDirPath)

If (success = True) Then
    Debug.WriteLine("Success.")
Else
    Debug.WriteLine(fac.LastErrorText)
End If