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!

1
  • Please check link it may help you
    – andy
    Commented Oct 5, 2012 at 5:10

1 Answer 1

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

1
  • Thanks between all the comments, I was able to figure it out.
    – password
    Commented Dec 12, 2012 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.