Results 1 to 11 of 11

Thread: [RESOLVED] old timer not working in this version of vb

  1. #1

    Thread Starter
    Lively Member cageybee's Avatar
    Join Date
    Nov 2005
    Location
    Stanardsville, VA
    Posts
    81

    Resolved [RESOLVED] old timer not working in this version of vb

    I've used this construct before and it worked fine. The idea is to release control to the system so that it can do "housekeeping". Leaving this out in the past caused the system to run out of memory eventually. (I'm doing alot of image loading and unloading). Visual Studio/ Visual Basic 2005 version 8.0.5

    System.Threading.Thread.CurrentThread.Sleep(10)

    get this error:

    Warning 2 Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated. C:\Visual Studio\Projects\Tracker\Form1.vb 627 17 Tracker

    Is there a newer construct?
    Last edited by cageybee; Jun 27th, 2008 at 08:26 AM.

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: old timer not working in this version of vb

    It should be just System.Threading.Thread.Sleep(10)
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  3. #3
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: old timer not working in this version of vb

    thread.sleep (10)

    I used to live in Montclair (Dumfries).
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: old timer not working in this version of vb

    cageybee - is that name a rounders reference in some way??? or just a russian one?

    anyways, these guys told you your answer, but I just wanted to chime in and say a few things.

    1) That is actually not an error, it is a warning, and there is a difference. The difference is the app will still run with the warning, and it will actually run correctly. It is just telling you what it plans to do at runtime, which is to use the correct version instead of the one you used.

    2) If you were to mouse over this line of code in VS, you would see a little red ! come up. Clicking the ! will bring up a correction window, because VS already knows how you need to fix this. You can simply click the correction in this window, and it will fix your code for you.

    The part circled in the screenshot is what you would click to auto fix your code.


    Also sleeping a thread is not the same thing as a timer, as sleeping the thread will freeze the thread. If its only for 10 milliseconds, then its generally not a big deal, however timers may be a better option depending on what exactly is going on.
    Attached Images Attached Images  

  5. #5

    Thread Starter
    Lively Member cageybee's Avatar
    Join Date
    Nov 2005
    Location
    Stanardsville, VA
    Posts
    81

    Re: old timer not working in this version of vb

    Thanks to all. cageybee is a "name" i've gone by for 40 years. It is a play on my initials KGB. I use it in gaming, and own the domains. Thanks especially for the tip on how to find the solution!! I live in the Charlottesville area now.....the mountains were calling!

  6. #6
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: old timer not working in this version of vb

    Did you ever see rounders? John Malkovich played a Russian poker player that they all called KGB.

  7. #7

    Thread Starter
    Lively Member cageybee's Avatar
    Join Date
    Nov 2005
    Location
    Stanardsville, VA
    Posts
    81

    Re: old timer not working in this version of vb

    I may have missed that...program or movie?

  8. #8
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: old timer not working in this version of vb

    Is the thread a background thread?

    I suppose if the app worked fine in the past, and didn't lag as a result of the sleep call, then you might as well go with it, but the whole description makes me think that there is a better answer, especially if this is the UI thread.
    My usual boring signature: Nothing

  9. #9

    Thread Starter
    Lively Member cageybee's Avatar
    Join Date
    Nov 2005
    Location
    Stanardsville, VA
    Posts
    81

    Re: [RESOLVED] old timer not working in this version of vb

    nope, foreground thread.
    Last edited by cageybee; Jun 27th, 2008 at 09:27 AM.

  10. #10
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: old timer not working in this version of vb

    Quote Originally Posted by cageybee
    I may have missed that...program or movie?
    Not looking to take this thread off topic, but since its marked resolved, it was a movie with ed norton and matt damon about poker. It actually came out in 1998 which was pretty much right before the huge poker boom that America has seen.

    http://www.imdb.com/title/tt0128442/

  11. #11
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: [RESOLVED] old timer not working in this version of vb

    I think I'll leave it at the movies. If the app works fine, then that's all that matters.
    My usual boring signature: Nothing

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