If you've ever used a Pocket PC device, you are likely familiar with the SIP keyboard -- it's that little mini keyboard that pops up on the bottom of the screen. When debugging, you can save yourself some time by entering data into your text boxes using the Watch window, instead of the SIP keyboard. Using Visual Studio, this is very easy.
During a typical debugging session, if the debuggee application takes text data (ex: a URL) from the user, I'll set a strategic breakpoint near the location where the data is first accessed, trigger the breakpoint, set the data and continue the application.
The example, below, uses the NetCF WebCrawler sample as my debuggee and Visual Studio .NET 2003 as my debugger.
After starting (F5) the WebCrawler, I set a breakpoint in the MainForm.startButton_Click method (MainForm.cs). In this application, the startButton_Click method reads the value of the TextBox labeled "Address", passes it to the crawler engine and starts the engine running. The exact location of the breakpoint is not important, as long as it is placed prior to where the code reads the text in the TextBox (addressBox in this sample). I usually set the breakpoint on the first line of the function.
Once set, click the Start button to trigger the breakpoint.
With the WebCrawler is stopped in the debugger, I switch to the Watch window and add "addressBox.Text" (the name of the TextBox control and the desired property) in the left-hand column. Since I have not yet entered a value for Address, the value, in the right-hand column, is the empty string (""). Once addressBox.Text has been added to the Watch window, I change the value to my desired URL; "http://www.microsoft.com", for example (including the quotation marks).
The text entered, the WebCrawler UI has the newly set value displayed in the Address box. Continue the application (F5) and the WebCrawler starts crawling your URL.
Please note: I do not recommend using this technique for username and password entry. For security reasons, a user's credentials should never be placed into the Watch window -- it is far too easy for someone looking over your shoulder to see the data and be able to access your account.
[Edit: categorize post]
Disclaimer(s):This posting is provided "AS IS" with no warranties, and confers no rights.