C#/.NET: TextBox is not 'focused' after a process was initiated

Posted by eibhrum on Stack Overflow See other posts from Stack Overflow or by eibhrum
Published on 2010-04-01T07:30:05Z Indexed on 2010/04/01 7:33 UTC
Read the original article Hit count: 343

Filed under:
|
|
|
|

Hi,

I am having a problem after opening the notepad once I click the button "btnSearch".

The idea is that once I clicked the button 'btnSearch', the textbox 'txtSearch' should be 'focused' even after a process was initiated/opened outside the main window.

Here's my code:

    private void btnSearch_Click(object sender, RoutedEventArgs e)
    {
        System.Diagnostics.Process.Start("notepad");
        txtSearch.Focus(); // not working
    }

Any suggestions?

© Stack Overflow or respective owner

Related posts about c#

Related posts about textbox