1

I have vb.net form that opens another vb.net exe to test. I am trying to test if a specific textbox has focus when the exe is loaded.

My tester form loads the exe using Assembly.UnsafeLoadFrom(_path) It then runs the FormtoTest on a new thread

I use the System.Type.GetProperty() and GetFields() functions to get all of the FormtoTest's input fields and their properties.

I then find this textbox in the list of input fields,

But when I call the System.Type.GetProperty("Focused"), I get an error: "Cross-thread operation not valid: Control 'txtID' accessed from a thread other than the thread it was created on."

Thanks for your help!

password
  • 471
  • 3
  • 12
  • Please check [link](http://stackoverflow.com/questions/5037470/cross-thread-operation-not-valid) it may help you – andy Oct 05 '12 at 05:10

1 Answers1

0

It sounds like you will need to use delegates

references

http://msdn.microsoft.com/en-us/library/ms951089.aspx

This is in C# but explains the basic concepts as well. http://www.codeproject.com/Articles/2083/The-key-to-multi-threaded-Windows-Forms-UI-interac

Austin Davis
  • 3,516
  • 10
  • 27
  • 47