View Full Version : VB Issues! (no surprise)
mmmdreg
Dec 29, 2003, 05:32 AM
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?
zellin
Dec 29, 2003, 08:54 AM
I'm probably missing something important or recently lost 50% of my brain cells, but what the hell is VB?
mmmdreg
Dec 29, 2003, 09:20 AM
Visual Basic :P Programming stuff ;)
Versello
Dec 29, 2003, 09:28 AM
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.
bousozoku
Dec 29, 2003, 10:51 AM
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
Versello
Dec 29, 2003, 04:38 PM
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.
bousozoku
Dec 29, 2003, 05:05 PM
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.
mmmdreg
Dec 30, 2003, 02:36 AM
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?
G5orbust
Dec 30, 2003, 02:43 AM
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!
szark
Dec 30, 2003, 02:57 AM
Couldn't you just do this? (Can't remember VB syntax, so here's my suggestion in C syntax):
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.
ChrisH3677
Dec 30, 2003, 05:03 AM
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
hvfsl
Dec 30, 2003, 06:46 AM
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.
bousozoku
Dec 30, 2003, 11:58 AM
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.
mmmdreg
Dec 30, 2003, 07:37 PM
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?
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.