Results 1 to 4 of 4

Thread: Possible Bug in VB6 SP3

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    Westminster, Md.
    Posts
    163
    This is an odd one... Even the guys at our help desk here and my Professor don't know what to make of it.

    The LEFT(), RIGHT() and MID() functions are used to chop off little bits of strings as we all know...Normally when you are coding a function and you hit the '(' a tooltip pops up telling you exactly what the function needs to work.

    I've had one instance where the RIGHT() function completely stopped working. In fact it caused a program of mine to crash. I was taking care of the App.path problem (wherein the APP.PATH method doesn't always return the final '\') and suddenly my program couldn't find any of my files. Now when I try to use LEFT() or RIGHT() the tool tip doesn't pop up (though it does on MID() )

    I used this code in the SUB MAIN() with gstrPath as a public variable:
    If Right(App.Path,1)<>"\" then
    gstrPath=App.Path & "\"
    Else
    gstrPath=App.Path
    End If

    I've taken to using the MID() function instead of right or left and just starting either with position 1 or the LEN() of the string. But because MID can be a little unwieldy at times, does anyone know why this happened or how to fix it?

    Help Desk guy thought it might have been a dll association that was missing, no dice there.

    I even went as far as to reinstall VB6 and SP3 but it's still happening....Odd thing is that I have the same setup in work and in class and they're all doing the same thing. MID() works just fine, but RIGHT() and LEFT() do not.

    Any advice?

    Eiredrake

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    Now that you mention it I've had a couple of minor oddities with left() and right().

    nothing too bad just sometimes when I hit the "(" I get the function info and sometimes I don't, that's about it though.

    If I use Left$() all seems to work better...

    Is there a difference (in performance) between left() and Left$() ???? It annoys me that they both exist and seem to be the same.

    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  3. #3
    Fanatic Member HaxSoft's Avatar
    Join Date
    May 2000
    Location
    Ohio
    Posts
    593
    Hey, Paul

    I think the difference is that the Left() function returns a variant and the Left$() returns a string. So I imagine there would be a slight difference in performance (the $ function would be faster) ... I don't know if the difference is significant, though.

    In any case, I ALWAYS use the $ version, because it returns a string and that is what I want. I really don't see why the variant version is even there? Must be a Microsoft thing, haha.

  4. #4
    New Member
    Join Date
    Oct 1999
    Posts
    14
    Yes, there is a difference. You should generally as a rule of thumb us the $ after those three functions. Otherwise you run the risk of crashing like he did.

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