-
Mar 27th, 2010, 05:53 AM
#1
Thread Starter
Lively Member
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!
-
Mar 27th, 2010, 06:09 AM
#2
Re: CrossThread operation
Follow the CodeBank link in my signature and check out my post on Accessing Controls From Worker Threads.
-
Mar 27th, 2010, 08:25 AM
#3
Thread Starter
Lively Member
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??
-
Mar 27th, 2010, 08:54 AM
#4
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.
-
Mar 27th, 2010, 10:53 AM
#5
Thread Starter
Lively Member
Re: CrossThread operation
works!!!
thanks thanks thanks!!
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|