function OpenWin(url, w, h) { if(!w) w = 400; if(!h) h = 300; window.open(url, "_new", "width=" + w + ",height=" + h + ",menubar=no,toobar=no,scrollbars=yes", true); } function Print() { window.focus(); if(window.print) { window.print(); window.setTimeout('window.close();',5000); } }
| Team-Fly | |
| Special Edition Using Microsoft® Visual Basic® .NET By Brian Siler, Jeff Spotts
| Table of Contents | | Chapter 24. Working with Files |
I need to store configuration data with an application on the end-user's PC. Of all the different methods, which one should I use? The answer depends on what type of data you want to store. The following list contains some examples: Simple variable/value pairs, such as default color scheme, file locations, or database connection string If just you or your program needs to access these values, put them in the registry. If an end user needs to edit these outside of your program or copy them to another computer, consider an INI file. Free-Form Text Message, such as the license agreement for your software Use a text file. Structured data, such as a list of states and their abbreviations for importing on program startup Create an XML file containing the information and distribute it with your application. Use the XML parser to read it in. Keep in mind these are general suggestions and may be adjusted to fit your needs. If you have an application that is continuously communicating with a database, you may want to store the extra information there as well.
What issues will I run into with accessing files over the network? If permissions are a problem, investigate the security functions in the FileIOPermission class. You may also need to use the Refresh method of a FileSystemInfo object that is open for a long time, if another network user changes the file. A user is sending me a large data file, but my file watcher program tries to upload it before he finishes sending the file and causes an error. How can I fix this? A professional scheduling package I looked at had an option to check whether a file size was stable over a period of time. You could write this functionality in VB pretty easily. However, an even easier fix is to get the user to send an empty file called done.txt after the data file is uploaded. Your program should then know when to start processing. Can I save database information to a file and reload it without reconnecting to the database? Yes; please see the ADO chapters, 21 and 22, for more information. |
| Team-Fly | |
|
| |
|