Replace method doesn't work because form has lost focus

  • Thread starter Thread starter Kevin993
  • Start date Start date
K

Kevin993

Guest
I have 2 forms. Both are shown at the same time.

These forms are not visible to user (Opacity=0 , not hided or visible=false) and there are some subs and threads in the first form that might add some content to a textbox in form1.

So , I also have a textbox in the first form. I want to use replace method with the textbox , but there is an issue:

When the first form is focused , replace method does change the textbox's content as desired. But when user runs other programs like notepad (means form1 has lost focus) , the replace method doesn't do anything unless form1 gets focused again. I guess it happens because the textbox is in form1. so when form 1 is not the active window maybe textbox is not active.



P.S I tried doing the replace method via form2 (form1.textbox.replace ...) to separate the replace method from the threads in the firs form that might interrupt the method, but issue still persists. I have to focus on form1 to make it happen

Continue reading...
 
Back
Top