Some Visual Basic .Net Programming

By William LaMartin, Editor, Tampa PC Users Group
lamartin@tampabay.rr.com


I spend a good bit of my time writing programs using Visual Basic .Net. In past years I used Delphi and Visual Basic. The more I use it, the more I appreciate VB .Net.

In the past month or so, I have written

I am also in the process of using VB .Net in the redo of a web site using ASP.Net technology.

The FTP program was written to satisfy a request from a friend who wanted a simple way for his clients to send files periodically to his server. The clients needed an “idiot-proof” way of doing the file uploads, and telling them to download a shareware FTP program, install it and figure out how to use it was clearly not “idiot-proof.” Here is the simple interface of the program. All they need do is supply a username and password, then log on. Once logged on, they then click the Upload File button and select the file to be uploaded from the directory tree. The file is then automatically sent via FTP to the server and put in the folder associated with that username.

There is no installation of the program; you simply place the executable on the desktop of any computer that has the .Net Framework installed (if not installed, the .Net Framework can be downloaded from Microsoft and easily installed).

The picture below  is the upper left hand portion of the stock portfolio program, displaying the status of a hypothetical portfolio and the one year graph of a selected stock, in this case Home Depot. The stock data is supplied by a free web service that has a 20-minute delay. The graphs are gotten from the Yahoo financial site.

For any stock you select, you can display both a graph for varying lengths of time and its statistical details. This program also needs no installation.

In general, a program will need no installation program if it does not reference any external dlls. To write the Zip and UnZip program, I had to use the SharpZipLib from http://www.icsharpcode.net. So this program required an installation program. But the installation program was small and no big deal. At present the program will unzip an archive of zipped folders within zipped folders to any depth, but will only zip a collection of folders with folders to a depth of 2. I need to come back at some time and write a recursive function to handle that process.

You might rightly ask, why write a program to do something that you can already get done for free. For example, Windows XP will zip and unzip things for you. Well, here is one reason. Say, I wrote a program that as output creates a large file and sends it somewhere using either FTP (as in the earlier example) or HTTP post to put it at a web site. I would like the file to be as small as possible. I could accomplish that by including the zip code within that program so that I zipped the file from within the program before sending it off. The Zip and UnZip interface is below.

Finally, I’ll write briefly about the inventory program. The problem basically was that I needed a way to get data out of a proprietary system that you could only access via a vendor-supplied Windows program which was basically just a wrapper for Telnet. (Remember Telnet, the way you communicated with another computer and viewed the session on a “DOS” screen for which you had to keep pressing Enter to see more data?) About the only thing the program will allow is for you to export the display memory to a text file.

So I wrote a program that opens this text file, parses out the desired information and displays it in table form. You can then sort based on each column or filter on the values in as many as three columns. You can then save the data as a text file or as an xml file. Finally, the most important thing is that you can press a button and the data will be uploaded to a web service which will then save it to the web site where you want to display the inventory information. The idea is that someone at the business will run this program once a day to update the web site information. And that is the end of my story. u