none
[vb.net] Multithreading a Sub returning an exception RRS feed

  • Pergunta

  • Hello, I'm using the Visual Studio 2015. The porblem is that i want to my application to start a new thread, wich i use:

    Dim trd As System.Threading.Thread = New System.Threading.Thread(AddressOf GetInf)        trd.IsBackground = True        trd.Start()
     I'm selecting a timer with interval 10000 (10 second) wich runs a series of subs, as (GET_INFO1() GETINFO2() GETINFO3() GETINFO4()), and as the timer tick, my forms stops, i can't click them or do anything until the timer finishes and all the subs are done, so using a multithreading is to not paralising the form because i am using a webbrowser and it can't happen, but i get exceptions when i try to do it.

    And the VS reaturning me a exception on "End Sub" of the sub that i want to do a new thread.

    this is the exception:

    Activated Event Time Duration Thread
    Exception thrown: 'System.InvalidCastException' in System.Windows.Forms.dll ("Specified cast is not valid.") 75.02s [9840] <No Name> 

    What do i need to do?

    tnx, i'm trying this for more then 4 hours to solvet his problem, but nothing

    sábado, 9 de abril de 2016 01:44

Respostas