|
-
Oct 10th, 2001, 06:38 PM
#1
Thread Starter
Fanatic Member
it just...stops
VB Code:
Open path For Binary As 1
bytPassword = Password
'it stops here
For z = 1 To LOF(1)
DispStatus z, LOF(1) 'diplay the status
Get #1, , bytIn
i've tried all sorts of error handling...and i have no clue why it just stops..if you need more code ill post it.
thanks
-nabeel
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Oct 10th, 2001, 06:44 PM
#2
Re: it just...stops
Originally posted by nabeels786
VB Code:
Open path For Binary As 1
bytPassword = Password
'it stops here
For z = 1 To LOF(1)
DispStatus z, LOF(1) 'diplay the status
Get #1, , bytIn
i've tried all sorts of error handling...and i have no clue why it just stops..if you need more code ill post it.
thanks
-nabeel
first thing youll have to do is change 1 to #1 like this
VB Code:
Open path For Binary As [B][COLOR=red]#[/COLOR][/B]1
bytPassword = Password
'it stops here
For z = 1 To LOF([B][COLOR=red]#[/COLOR][/B]1)
DispStatus z, LOF([B][COLOR=red]#[/COLOR][/B]1) 'diplay the status
Get [B][COLOR=red]#[/COLOR][/B]1, , bytIn
-
Oct 11th, 2001, 04:49 PM
#3
Thread Starter
Fanatic Member
i have code in another function that does the same thing the same way, it gives no problems.
however, i changed it, it still suddenly stops. no errors or anything. the program is functional though.
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Oct 11th, 2001, 05:07 PM
#4
OK, thats great, but still put the #s in there.
-
Oct 11th, 2001, 05:46 PM
#5
The #'s really don't matter. They don't have to be there. If you want them there, put them in. If you don't, leave them out. It really doesn't matter.
Now, onto the real question, are you saying that VB never enters the loop? If so, this is the line with the problem:
For z = 1 To LOF(1)
LOF returns a boolean balue, which is only either true or false, or, in vb terms, -1 or 0. Whichever it returns, it's already less than 1, so the loop never starts. Maybe you mean to put something like this:
VB Code:
Open path For Binary As 1
bytPassword = Password
Do Until LOF(1)
z = z + 1
DispStatus z, LOF(1) 'diplay the status
Get #1, , bytIn
-
Oct 11th, 2001, 05:50 PM
#6
Originally posted by Tygur
The #'s really don't matter. They don't have to be there. If you want them there, put them in. If you don't, leave them out. It really doesn't matter.
If you want your code to be readable later, it does matter, and if you want to follow a general coding practice it does matter. Bottom line is, it makes for very ugly code to write it without them.
-
Oct 11th, 2001, 06:05 PM
#7
Originally posted by rickm
If you want your code to be readable later, it does matter, and if you want to follow a general coding practice it does matter. Bottom line is, it makes for very ugly code to write it without them.
I don't think the #'s make the code more readable. If you think it does, go ahead and do it. Nobody's stopping you.
Also, it depends on what general coding practice you follow. If the coding practice you follow requires the #'s, go ahead and throw them in. Otherwise, leave them out.
I don't believe code without the #'s is necessarily ugly. The idea is to be consistent. If you usualy put the #'s in, it's a good idea to put them everywhere. If you usually leave them out, it's probably a good idea to leave them out everywhere. Putting them in at some places and leaving them out at others doesn't look too good, but as long as you're consistent, you should have any problem.
If there is any problem with the way that code handles file numbers, it's the use of 1 (or #1) instead of FreeFile and a variable to hold the file number.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|