|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
force exit in while loop or read first line from a file
hello
I am beginner in Vb6 I have not found in MSDN how to force exit from a while loop (break not work) And another question, how to open very faster a big txt file, and to read only first line from this file? My solution not work: Code:
Open FileName For Input As y
Do While Not EOF(x)
Line Input #y, r
arrInfo = Split(r, ",")
numar_pagini = CInt(arrInfo(0))
font_size = CInt(arrInfo(1))
break
Loop
Close (y)
OR
Open FileName For Input As y
Dim j As Integer
j=0
Do While Not EOF(x)
Line Input #y, r
If(StrComp(j,0)=0) Then
arrInfo = Split(r, ",")
numar_pagini = CInt(arrInfo(0))
font_size = CInt(arrInfo(1))
break
EndIf
j=j+1
Loop
Close (y)
Is total stupid if I can't exit with break from a loop ! |
|
#2
|
|||
|
|||
|
Use "exit do" or "exit for" or "wend" (for while loops)
|
|
#3
|
||||
|
||||
|
You can do a break in a loop. . You just have to include a conditional (if....then... else or select case statement), and in the instance that you want to break from the loop, you use the syntax "Exit For", for a for loop, and "Exit Do" for a do loop.
__________________
Fisherman "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > force exit in while loop or read first line from a file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|