Click here to Skip to main content
15,885,278 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Reading the contents of a file into an array Pin
proneal24-May-12 11:02
proneal24-May-12 11:02 
AnswerRe: Reading the contents of a file into an array Pin
Luc Pattyn24-May-12 11:53
sitebuilderLuc Pattyn24-May-12 11:53 
GeneralRe: Reading the contents of a file into an array Pin
proneal24-May-12 11:56
proneal24-May-12 11:56 
GeneralRe: Reading the contents of a file into an array Pin
proneal24-May-12 11:58
proneal24-May-12 11:58 
GeneralRe: Reading the contents of a file into an array Pin
Luc Pattyn24-May-12 12:08
sitebuilderLuc Pattyn24-May-12 12:08 
AnswerRe: Reading the contents of a file into an array Pin
Dave Kreskowiak23-May-12 7:20
mveDave Kreskowiak23-May-12 7:20 
GeneralRe: Reading the contents of a file into an array Pin
GeorgieMPorgie23-May-12 7:49
GeorgieMPorgie23-May-12 7:49 
AnswerRe: Reading the contents of a file into an array Pin
Luc Pattyn23-May-12 13:56
sitebuilderLuc Pattyn23-May-12 13:56 
I'm afraid you still haven't figured out why it failed the way you did it. You opened a file, then had a loop reading all its contents (till Peek fails), en then another loop supposed to read all content again. However you never told the file it should restart at the beginning (the again was in your mind, not in your code), so your second loop starts at the end of the file (where it had left off when the first loop ended) and then obviously finds nothing more. To restart a file, either close and open it again, or simply set its Position to zero.

So either do it yourself (as you tried) but do it correctly, or use what is available to tackle the most popular situations, such as File.ReadAllLines(). Quite often, less code also means fewer bugs.

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum

GeneralRe: Reading the contents of a file into an array Pin
GeorgieMPorgie23-May-12 15:48
GeorgieMPorgie23-May-12 15:48 
AnswerRe: Reading the contents of a file into an array Pin
frostcox25-May-12 10:37
frostcox25-May-12 10:37 
GeneralRe: Reading the contents of a file into an array Pin
GeorgieMPorgie25-May-12 16:27
GeorgieMPorgie25-May-12 16:27 
QuestionVB Remoting - How do you get the server to pass value to client? Pin
Cutha22-May-12 19:57
Cutha22-May-12 19:57 
AnswerRe: VB Remoting - How do you get the server to pass value to client? Pin
Bernhard Hiller23-May-12 4:14
Bernhard Hiller23-May-12 4:14 
GeneralRe: VB Remoting - How do you get the server to pass value to client? Pin
Cutha24-May-12 14:57
Cutha24-May-12 14:57 
QuestionCrystal Report 8.5 Connectivity(Parameterised or data as per record set) with Oracle using VB6 Pin
compad22-May-12 0:09
compad22-May-12 0:09 
QuestionRe: Crystal Report 8.5 Connectivity(Parameterised or data as per record set) with Oracle using VB6 Pin
Eddy Vluggen22-May-12 9:05
professionalEddy Vluggen22-May-12 9:05 
AnswerRe: Crystal Report 8.5 Connectivity(Parameterised or data as per record set) with Oracle using VB6 Pin
compad22-May-12 22:33
compad22-May-12 22:33 
GeneralRe: Crystal Report 8.5 Connectivity(Parameterised or data as per record set) with Oracle using VB6 Pin
Eddy Vluggen23-May-12 0:18
professionalEddy Vluggen23-May-12 0:18 
GeneralRe: Crystal Report 8.5 Connectivity(Parameterised or data as per record set) with Oracle using VB6 Pin
compad23-May-12 23:31
compad23-May-12 23:31 
QuestionCannot connect to SQL in VB6 COM DLL called from C# Pin
soporificeffect20-May-12 22:34
soporificeffect20-May-12 22:34 
QuestionGet 1st dimension values of a 2-dimensional array into 1-dimensional array Pin
Sonhospa18-May-12 8:28
Sonhospa18-May-12 8:28 
AnswerRe: Get 1st dimension values of a 2-dimensional array into 1-dimensional array Pin
Dave Kreskowiak22-May-12 5:08
mveDave Kreskowiak22-May-12 5:08 
GeneralRe: Get 1st dimension values of a 2-dimensional array into 1-dimensional array Pin
Sonhospa22-May-12 22:33
Sonhospa22-May-12 22:33 
QuestionWeb Browser without IE 7 dependencies Pin
Brandon-X1200018-May-12 6:51
Brandon-X1200018-May-12 6:51 
AnswerRe: Web Browser without IE 7 dependencies Pin
Dave Kreskowiak18-May-12 8:50
mveDave Kreskowiak18-May-12 8:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.