Appendix A. Creating a Windows Application for ClickOnce
To understand how ClickOnce works, this appendix covers how to create a Windows application using Visual Studio 2005. For this application, I will use the Visual Basic 2005 programming language. (My latest book from O'Reilly, Visual Basic 2005 Jumpstart, includes three hands-on projects that let you learn the new syntax quickly; check http://www.oreilly.com/catalog/vbjumpstart/index.html for more information.)
Launch Visual Studio 2005 and name the application MyApp. Populate the default Form1 with seven Button controls, as shown in Figure 1-20.
Figure 1-20. Populating the default Form1 with Button controls
The application will perform the following functions:
Let the user open a file and read its content.
Let the user select a file and save some content into the selected file.
Access an external web service (MSN Search).
Access a web service hosted on the same server that hosts the ClickOnce installation files.
Read the registry settings on the local computer.
Insert a record into a local database and then display the content of the database.
Display the content of a text file.
The following sections show the logic under each of the Button controls.
Disk I/O: Reading
The "Open a File" button displays an Open File dialog window to allow users to select a file. Once you've selected a file, you will read its content and display it in a message ...