Results 1 to 15 of 15

Thread: Illiad vs. VB6.0 (who's retarded?)

  1. #1

    Thread Starter
    Addicted Member Illiad's Avatar
    Join Date
    Mar 2003
    Location
    Chicago
    Posts
    196

    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:
    1. Private Sub Timer1_Timer()
    2. BlockInput True
    3. If lbltime.Caption > 0 Then
    4.     lbltime.Caption = lbltime.Caption - 1
    5. Else
    6.     lbltime.Enabled = False
    7.     BlockInput False
    8.     Sleep 800
    9.     Unload frmLocked
    10.     Unload frmWinLock
    11.     Timer1.Enabled = False
    12.     End
    13. End If
    14. End Sub
    15. Private Sub Timer2_Timer()
    16. BlockInput True
    17. lbltime.Caption = "++++"
    18. If lbltime.ForeColor = &H80000012 Then
    19.     lbltime.ForeColor = &HE0E0E0
    20. Else
    21.     lbltime.ForeColor = &H80000012
    22. End If
    23. End Sub
    24. Private Sub Timer3_Timer()
    25. BlockInput True
    26. If lbltime.Caption > 0 Then
    27.     lbltime.Caption = lbltime.Caption - 1
    28. Else
    29.     lbltime.Enabled = False
    30.     BlockInput False
    31.     Sleep 800
    32.     Unload frmLocked
    33.     Unload frmWinLock
    34.     Timer1.Enabled = False
    35.     End
    36. End If
    37. 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.

  2. #2
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    VB Code:
    1. 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

  3. #3

    Thread Starter
    Addicted Member Illiad's Avatar
    Join Date
    Mar 2003
    Location
    Chicago
    Posts
    196
    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.

  4. #4
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    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

  5. #5

    Thread Starter
    Addicted Member Illiad's Avatar
    Join Date
    Mar 2003
    Location
    Chicago
    Posts
    196
    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.

  6. #6
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    Do you have an On Error Resume Next?
    VB Code:
    1. Private Sub Command1_Click()
    2. On Error Resume Next
    3. MsgBox "hello"
    4. Call SomeSub
    5. MsgBox "bye"
    6. End Sub
    7.  
    8. Private Sub SomeSub()
    9. If Label1.Caption > 0 Then
    10.     MsgBox "???"
    11. Else
    12.     MsgBox "!!!"
    13. End If
    14.  
    15. 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

  7. #7
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    As to the integer vs string question, try this code out
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim x As Integer
    3. x = 25
    4. Label1.Caption = x
    5. MsgBox Label1.Caption
    6. MsgBox TypeName(Label1.Caption)
    7. 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

  8. #8

    Thread Starter
    Addicted Member Illiad's Avatar
    Join Date
    Mar 2003
    Location
    Chicago
    Posts
    196
    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.

  9. #9
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    Just letting U know we cross-posted

    "Brothers, you asked for it."
    ...Francisco Domingo Carlos Andres Sebastian D'Anconia

  10. #10

    Thread Starter
    Addicted Member Illiad's Avatar
    Join Date
    Mar 2003
    Location
    Chicago
    Posts
    196
    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.

  11. #11
    Frenzied Member KayJay's Avatar
    Join Date
    Jul 2001
    Location
    Chennai
    Posts
    1,849
    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

  12. #12

    Thread Starter
    Addicted Member Illiad's Avatar
    Join Date
    Mar 2003
    Location
    Chicago
    Posts
    196
    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.

  13. #13
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    lbltime.Caption = "++++"
    That aint no number I ever saw...
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

  14. #14
    Frenzied Member agmorgan's Avatar
    Join Date
    Dec 2000
    Location
    Lurking
    Posts
    1,383
    So is the conclusion of this thread that Illiad is retarded?

  15. #15

    Thread Starter
    Addicted Member Illiad's Avatar
    Join Date
    Mar 2003
    Location
    Chicago
    Posts
    196
    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
  •  



Click Here to Expand Forum to Full Width