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!
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