|
-
Mar 27th, 2003, 12:17 AM
#1
Thread Starter
Addicted Member
Illiad vs. VB6.0 (who's retarded?)
I don't get this at all! I'm making a program that "Locks" windows for a defined period of time. I have 3 settings. Setting 1 is to lockdown for a certain ammount of time. Setting 2 is to lock permanently. Setting 3 is to restart once the timer is completed. That's where the problem is! In setting 3's Subroutine...
Heres a fragment of the code...
VB Code:
Private Sub Timer1_Timer()
BlockInput True
If lbltime.Caption > 0 Then
lbltime.Caption = lbltime.Caption - 1
Else
lbltime.Enabled = False
BlockInput False
Sleep 800
Unload frmLocked
Unload frmWinLock
Timer1.Enabled = False
End
End If
End Sub
Private Sub Timer2_Timer()
BlockInput True
lbltime.Caption = "++++"
If lbltime.ForeColor = &H80000012 Then
lbltime.ForeColor = &HE0E0E0
Else
lbltime.ForeColor = &H80000012
End If
End Sub
Private Sub Timer3_Timer()
BlockInput True
If lbltime.Caption > 0 Then
lbltime.Caption = lbltime.Caption - 1
Else
lbltime.Enabled = False
BlockInput False
Sleep 800
Unload frmLocked
Unload frmWinLock
Timer1.Enabled = False
End
End If
End Sub
The settings are represented by timers (e.g. setting 1 is timer1 and so on)
Whenver I run the program on setting 3 I get this error message "Runtime Error Type 13, Type Mismatch" on the "If lbltime.Caption > 0 Then" line on timer3. However, as you may see above, the code for timer1 and timer3 are the same. I know that timer3 won't restart windows cauz I havent augmented its code yet. But VB only gets the error on timer3...whats going on?!
Note: lbltime.caption is set by a variable "seconds", "seconds" is a public integer.
Last edited by Illiad; Mar 27th, 2003 at 12:26 AM.
Quis Custodiet Ipsos Custodes?
You don't have to be faster than the bear, you just have to be faster than the slowest person running from the bear.
-
Mar 27th, 2003, 12:44 AM
#2
Frenzied Member
VB Code:
If lbltime.Caption > 0 Then
> 0 is a nymeric operation. Cannot be done with a string, lbltime.Caption. Use Val(lbltime.Caption)
HTH
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
-
Mar 27th, 2003, 12:54 AM
#3
Thread Starter
Addicted Member
But y does it work in Private Sub Timer1_timer() and not Private Sub Timer3_timer() ?
Besides, its not like the label contains any words, just an integer. > can work with integers.. integers are numarical vaues last I checked...lol j/p
Last edited by Illiad; Mar 27th, 2003 at 01:00 AM.
Quis Custodiet Ipsos Custodes?
You don't have to be faster than the bear, you just have to be faster than the slowest person running from the bear.
-
Mar 27th, 2003, 01:00 AM
#4
Frenzied Member
AFAIK, It should not work there as well. Set break points on both the "IF" conditions and see if the conditions fire, and if they do, check whether both return an erorr. They should, AFAIK
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
-
Mar 27th, 2003, 01:02 AM
#5
Thread Starter
Addicted Member
I've programmed appz using similar code and never ran into this problem, like I said, the label contains an Integer...no strings attached
Quis Custodiet Ipsos Custodes?
You don't have to be faster than the bear, you just have to be faster than the slowest person running from the bear.
-
Mar 27th, 2003, 01:07 AM
#6
Frenzied Member
Do you have an On Error Resume Next?
VB Code:
Private Sub Command1_Click()
On Error Resume Next
MsgBox "hello"
Call SomeSub
MsgBox "bye"
End Sub
Private Sub SomeSub()
If Label1.Caption > 0 Then
MsgBox "???"
Else
MsgBox "!!!"
End If
End Sub
The above will not display an error at all, though there is one.
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
-
Mar 27th, 2003, 01:11 AM
#7
Frenzied Member
As to the integer vs string question, try this code out
VB Code:
Private Sub Command1_Click()
Dim x As Integer
x = 25
Label1.Caption = x
MsgBox Label1.Caption
MsgBox TypeName(Label1.Caption)
End Sub
U'll find out what kind of type/variable "Label1.Caption" is
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
-
Mar 27th, 2003, 01:11 AM
#8
Thread Starter
Addicted Member
No, I never know of that command, I fixed it though...I just removed the vars and just did some old fashiond Let commands 
thanks anyways
Quis Custodiet Ipsos Custodes?
You don't have to be faster than the bear, you just have to be faster than the slowest person running from the bear.
-
Mar 27th, 2003, 01:15 AM
#9
Frenzied Member
Just letting U know we cross-posted
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
-
Mar 27th, 2003, 01:25 AM
#10
Thread Starter
Addicted Member
cross posted? im confused....
Quis Custodiet Ipsos Custodes?
You don't have to be faster than the bear, you just have to be faster than the slowest person running from the bear.
-
Mar 27th, 2003, 01:38 AM
#11
Frenzied Member
Our posts crossed. Both you and I posted at the same time. So we may have missed some of each other's posts and moved on to the next ones. Scroll up and see the times of your posts and mine. One them will be identical.
Anyways, glad you sorted it out, though I am still unable to see where things went wrong.
Cheers and Good Luck
Regards
KayJay
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
-
Mar 27th, 2003, 02:36 AM
#12
Thread Starter
Addicted Member
lol i got it...thats funny i guess
Quis Custodiet Ipsos Custodes?
You don't have to be faster than the bear, you just have to be faster than the slowest person running from the bear.
-
Mar 27th, 2003, 04:31 AM
#13
Frenzied Member
That aint no number I ever saw...
-
Mar 27th, 2003, 05:04 AM
#14
Frenzied Member
So is the conclusion of this thread that Illiad is retarded?
-
Mar 27th, 2003, 06:52 PM
#15
Thread Starter
Addicted Member
I know "++++" is not a number, but if you read the code that is timer2's subroutine, and if you graduated 1st grade math you'd know 2 isn't 1 or 3 j/p
in conclusion:
VB6.0 is retared. If what KayJay was saying is correct (and i think it is), then VB should have cought the error on the Timer1_Timer subroutine, but it didn't so VB is retarded...
Last edited by Illiad; Mar 27th, 2003 at 06:56 PM.
Quis Custodiet Ipsos Custodes?
You don't have to be faster than the bear, you just have to be faster than the slowest person running from the bear.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|