Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mmmdreg

macrumors 65816
Original poster
Apr 14, 2002
1,393
0
Sydney, Australia
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?
 
Re: VB Issues! (no surprise)

Originally posted by mmmdreg
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?

Some code would be nice.
 
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
 
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.
 
Originally posted by Versello
I hate to say this too, but a computer is only as dumb as the user :rolleyes:

...

Was rudeness necessary in finding an answer? You have no idea how smart he is.
 
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?
 
Originally posted by mmmdreg


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?

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!
 
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.
 
Originally posted by Versello
I hate to say this too, but a computer is only as dumb as the user :rolleyes:

??!!! 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
 
Originally posted by ChrisH3677
??!!! 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

: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.
 
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.
 
Originally posted by bousozoku
How about:

while windowSize < 6625
windowSize = windowSize + 25
endwhile

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 ->
When I get problems like this, I recreate the program from scratch.
Would you really do that for thousands of lines of code?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.