Results 1 to 2 of 2

Thread: VS2005 BETA2 error

  1. #1

    Thread Starter
    Addicted Member Filik's Avatar
    Join Date
    Aug 2005
    Posts
    208

    VS2005 BETA2 error

    Hi,
    i've come across a very strange error in 2005 BETA2, it shows up when i try to access the visible property of a progress bar from a button, it says:
    "Progressbar1 was accsesed from a thread other then it was created"
    Is there anyway to go around this error?
    thx
    They shout: "Give us cheap oil!"
    What will they shout when all the oil is gone? "Give us another planet full of oil!"



    1 Cigarete takes away 15 minutes of life, 1 minute of laughter gives you 15 minutes of life. What should you do?
    Smoke weed!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: VS2005 BETA2 error

    That's not a strange error at all, and it means exactly what it says. You weren't supposed to make cross thread method calls in VS.NET 2003 but that was not enforced. In VS 2005 it is enforced, although I have a feeling it is only while debugging and not in release, although that should be a good enough indication that it is a bad idea. The only members of the Control and derived classes that are thread-safe are Invoke, BeginInvoke, EndInvoke and CreateGraphics, so these are the only members you should access between threads. if you want to access other members, you should call Invoke or BeginInvoke and use a delegate. See the following thread for an example, and I recommend some reading on the subject in the help or on MSDN.

    http://www.vbforums.com/showthread.p...light=delegate
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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