VB Issues! (no surprise)

Discussion in 'General Mac Discussion' started by mmmdreg, Dec 29, 2003.

  1. mmmdreg macrumors 65816

    mmmdreg

    Joined:
    Apr 14, 2002
    Location:
    Sydney, Australia
    #1
    So I got a simple timer that is resizes a tab from one number to another and stops when it gets there. I'm simply adding 25 onto the number until it reaches the size and it stops. VB has decided to not be capable of adding/subtracting 25 and every so often it only adds 24 and therefore the two sizes never actually equal each other and therefore it just keeps getting bigger/smaller. How do you get around this stupid issue?
     
  2. zellin macrumors regular

    Joined:
    Nov 23, 2003
    Location:
    Phoenix, AZ
    #2
    I'm probably missing something important or recently lost 50% of my brain cells, but what the hell is VB?
     
  3. mmmdreg thread starter macrumors 65816

    mmmdreg

    Joined:
    Apr 14, 2002
    Location:
    Sydney, Australia
  4. Versello macrumors regular

    Joined:
    Nov 13, 2003
    #4
    Re: VB Issues! (no surprise)

    Some code would be nice.
     
  5. bousozoku Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #5
    If you're not using integers, you might never reach an exact match.

    It would be nice to not have to guess at what you're doing though. :D
     
  6. Versello macrumors regular

    Joined:
    Nov 13, 2003
    #6
    I hate to say this too, but a computer is only as dumb as the user :rolleyes:

    It's most likely logic error in your code, like bousozoku mentioned.
     
  7. bousozoku Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #7
    Was rudeness necessary in finding an answer? You have no idea how smart he is.
     
  8. mmmdreg thread starter macrumors 65816

    mmmdreg

    Joined:
    Apr 14, 2002
    Location:
    Sydney, Australia
    #8
    I was using integers. I don't see how 6600 + 25 can possibly equal 6624 though. Buuuuut, I got past the problem. It seems the problem is with the SSTab thingies so I just canned that idea and resized the window by itself. The idea is I'm just making the window resize like in OSX for visual effect.

    As for Versello, listen to Bousozoku's reply to you.

    As for the code, it's just a timer with an interval of 1 and
    windowSize = windowSize + 25.
    I mean, one line of code isn't exactly that hard to figure out is it?
     
  9. G5orbust macrumors 65816

    G5orbust

    Joined:
    Jun 14, 2002
    #9
    Can VB do compound assignment operators like Java? If so, make your code look snazzy by doing:

    windowSize+=25

    woo hurray for AP Comp Sci!
     
  10. szark macrumors 68030

    szark

    Joined:
    May 14, 2002
    Location:
    Arid-Zone-A
    #10
    Couldn't you just do this? (Can't remember VB syntax, so here's my suggestion in C syntax):

    Code:
    stepSize = 25;
    
    if (windowSize < desiredSize - stepSize) {
      windowSize = windowSize + stepSize;
    }
    else {
      windowSize = desiredSize;
      //stop!
    }
    As far as the '6600 + 25 equals 6624' problem, the SSTab control might have restrictions (bugs?) on widths or pixel boundaries, and it will adjust itself to fit those parameters (like it or not). It doesn't happen often, but I have seen it once or twice in my limited VB experience.
     
  11. ChrisH3677 macrumors 6502a

    Joined:
    Oct 6, 2003
    Location:
    Victoria, Australia
    #11
    ??!!! Haven't you ever used Windoze???? You can't blame it on users!

    And can we blame "dumb users" for the message "No keyboard detected. Press any key to continue" ?

    It's designers, developers and budgets that make computers "dumb".

    :D
     
  12. hvfsl macrumors 68000

    hvfsl

    Joined:
    Jul 9, 2001
    Location:
    London, UK
    #12
    :D I have never got that message before.

    Anyway back to VB, it sounds like you have something in your program that is doing something it shouldnt. (maybe there is a limit to the size you can have) When I get problems like this, I recreate the program from scratch.
     
  13. bousozoku Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #13
    How about:

    while windowSize < 6625
    windowSize = windowSize + 25
    endwhile

    I've done too much VB programming, as well as other Windows programming and find that:

    1) there are windows controls issues which have become standard features

    2) VB (which sounds strangely like an STD) has many inaccuracies, but works. It's actually not much different from their original BASIC interpreter which was also a pain.
     
  14. mmmdreg thread starter macrumors 65816

    mmmdreg

    Joined:
    Apr 14, 2002
    Location:
    Sydney, Australia
    #14
    Yeah I basically did that but it's just in IF statements instead because it's inside the code for the timer. While will just do it instantly I'd assume. We only want it done once per cycle. But anyhoo, I scrapped the tabs. Tis all good.

    BTW hfvsl ->
    Would you really do that for thousands of lines of code?
     

Share This Page