Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF crashes on Focus()

$
0
0
 
I am facing an issue with setting focus to TextBox controls in WPF. I don't have my stack trace at this time (writing this from home), but this is the problem in a nutshell:
 
I have developed my desktop GUI using WPF. I use Focus() in many places to display a virtual keyboard, if the user clicks on a text box. The program has been running with no problem when executed directly or from the debugger.
 
 One of my requirements is that my program should always be running (re-start if a crash occurs, for example). Henceforth, I have written a .NET service that monitors processes in the background and fires up my program if it doesn't find it running. I use System.Diagnostics.Process.Start to re-run my exe. This is where my problem starts. When I bring up my program from within my service I get null reference errors for every Focus() call that I make.
 
Can someone give me some insight on why this is happening and how to fix it? I am running out of solutions.

Thanks


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>