Results 1 to 5 of 5

Thread: CrossThread operation

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2007
    Posts
    104

    CrossThread operation

    Hi,
    i create a thread that load a function, in this function i need to read from txtbox into the same form and during the function write into another textbox

    the call to function is done in this way

    Code:
    Dim t As Thread
    t = New Thread(AddressOf Me.myFunction)
    t.Start()

    from myFunction i read info in this way

    Code:
    myInfo = textbox1.text
    and i write into textbox during the execution of myFunction in this way

    Code:
    textInfo.text = myInfo
    but in debug time i have an error of crossthread..
    how can i solve this problem??

    please help me!
    Report your software freeware, it's free

    http://intotheapp.blogspot.com

    a blog with only free software

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

    Re: CrossThread operation

    Follow the CodeBank link in my signature and check out my post on Accessing Controls From Worker Threads.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2007
    Posts
    104

    Re: CrossThread operation

    thanks,
    but i still have problem with printing from myFunction
    the code that i use is this

    from myFunction:

    printReport() 'Function to print on textbox


    the printReport function has this code

    If txtReport.InvokeRequired Then

    Else
    Me.txtReport.Text = report
    End If


    but this doesn't work...
    don't give me errors but don't write into txtbox
    why??
    Report your software freeware, it's free

    http://intotheapp.blogspot.com

    a blog with only free software

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: CrossThread operation

    You've got nothing in your If block. You need to follow the instructions I provided to add code to the If block too.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2007
    Posts
    104

    Re: CrossThread operation

    works!!!
    thanks thanks thanks!!
    Report your software freeware, it's free

    http://intotheapp.blogspot.com

    a blog with only free software

Tags for this Thread

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