In All the other methods I've tried, I run into a barrier(around 170K+) where loading a file suddenly becomes very slow. I've tried many methods found here and in books, and none have proven to work as well as I was looking for.
After a long search I ended up spending some off-time figuring a way out myself. This is what I came up with.(speed increases from 20 seconds@170k to .4 seconds@170k)
Inputs
Parameter 1: Path
Path is the path to the file. If there is no file, the program will return nothing.
Assumes
Remeber that strings in VB are limited. I believe it is somwhere around 2.1gigs. if you happen to be authoring an application for a machine that can handle that much, you should seriously consider an alternate method.
Returns
It returns a binary string(an ordinary string, just that the bytes contain any character, not just Ansi Text). the file is completely loaded into memory.
Side Effects
Remember that this is probably the fastest way to load a file into memory. if your file is larger than the available memory, then it will become slow, and a major burden on the system.