From: simonc on 30 Apr 2010 07:53 I want to make a loop to read data from a succession of binary files (filepaths of the files are in a string array). If I create a new filestream and from that a new binary reader before the start of the loop how can I redefine the filestream to look at a different file each time I go through the loop? Grateful for advice
From: Andrew Morton on 30 Apr 2010 08:12 simonc wrote: > I want to make a loop to read data from a succession of binary files > (filepaths of the files are in a string array). > > If I create a new filestream and from that a new binary reader before > the start of the loop how can I redefine the filestream to look at a > different file each time I go through the loop? You can make a new instance for each loop iteration: For Each f In files Using br = New BinaryReader(New FileStream(f, FileMode.Open)) ' do something with br End Using Next -- Andrew
From: simonc on 30 Apr 2010 11:17 Thanks very much for this. I've never come across Using before.
|
Pages: 1 Prev: Lots of ActiveX COM Controls are missing in "Choose Items" ? Next: VB.net |