Results 1 to 7 of 7

Thread: it just...stops

  1. #1

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919

    it just...stops

    VB Code:
    1. Open path For Binary As 1
    2.     bytPassword = Password
    3.     'it stops here
    4.     For z = 1 To LOF(1)
    5.         DispStatus z, LOF(1) 'diplay the status
    6.          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?

  2. #2
    rickm
    Guest

    Re: it just...stops

    Originally posted by nabeels786
    VB Code:
    1. Open path For Binary As 1
    2.     bytPassword = Password
    3.     'it stops here
    4.     For z = 1 To LOF(1)
    5.         DispStatus z, LOF(1) 'diplay the status
    6.          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:
    1. Open path For Binary As [B][COLOR=red]#[/COLOR][/B]1
    2.     bytPassword = Password
    3.     'it stops here
    4.     For z = 1 To LOF([B][COLOR=red]#[/COLOR][/B]1)
    5.         DispStatus z, LOF([B][COLOR=red]#[/COLOR][/B]1) 'diplay the status
    6.          Get [B][COLOR=red]#[/COLOR][/B]1, , bytIn

  3. #3

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    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?

  4. #4
    rickm
    Guest
    OK, thats great, but still put the #s in there.

  5. #5
    Tygur
    Guest
    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:
    1. Open path For Binary As 1
    2.     bytPassword = Password
    3.     Do Until LOF(1)
    4.         z = z + 1
    5.         DispStatus z, LOF(1) 'diplay the status
    6.          Get #1, , bytIn

  6. #6
    rickm
    Guest
    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.

  7. #7
    Tygur
    Guest
    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
  •  



Click Here to Expand Forum to Full Width