Accessing controls from threads - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Accessing controls from threads

jim.barrettjim.barrett Posts: 1Member

I hope some one that give me a nice clear answer to this as I'm at my ends whits with it.

Ok I have form1 and a button on that opens form2. Form2 starts a thread that will create report for me. When the threads start it executes some code that accesses controls on form1. Of course you know this wouldn't work because I'm getting errors as its unsafe. The code is very simple

if form1.checkbox.checked then
' Do something
end if

I have many checkboxes on form1 that I need to check so is there a way I can do this from the thread quickly and safely?

I also calls a public function in the thread that is in form1 that adds data to a tree view.

Please HELP!

Sign In or Register to comment.