VB.Net using Visual Studio is another great language to learn. If you like VB.Net you may eventually like C#, and vice versa. It has sophisticated data structures, can be Object Oriented and makes great Windows desktop applications or can be the code behind an ASP.Net website or web application. Here we use it in a Visual Studio Console Application project, used because what we are using VB.Net for here does not require a Windows Form.
To understand why we use VB.Net to do this job of displaying the Web Favourites in a dropdown, we must understand how Javascript and other client web languages can not access the underlying operating system of the client computer (laptop, in our case). Why should that matter? Well, Web Favourites are controlled by the Web Browser, which is a desktop program that has access to local file systems and the operating system of the client. This Web Browser (and for this .Net application we are defaulting to Internet Explorer) saves its Web Favourites to the file system of the client and controllable by the client operating system, but therefore, not accessible to Javascript or other web browsing client agents. So what can we do, to achieve the aims of this tutorial? Well, what I’ve decided to do, is to assume you are using an EasyPHP local web server, and to write a Visual Studio VB.Net desktop (console) application that can reach, access and read those Web Favourites files and write to EasyPHP’s http://127.0.0.1/ (the mapping of which can be gleaned by looking at the client’s PATH environment variable and was C:Progra~1EasyPHP-12.1www in my case), to a file called MyFavourites.html and finish off by executing that MyFavourites.html with Internet Explorer. You’ll be getting the hint that this is a Windows tutorial, but as soon as I said VB.Net that had to be the case!
You could well ask why do this, when the browser can do it, but you may have forgotten what a programmer does, and is interested in. A programmer arranges to be able to make things happen in a controllable way, so with what this program does, it could be extended in functionality to do a lot of other things now that the data is web-accessible for both client and server, from using PHP or ASP.Net server-side programs to write to files or a database, or to glean information from the Web Favourites list destination websites (which we may do in another tutorial of the future … VB.Net More on Web Browser Favourites Tutorial). Of course there would be other ways to achieve this same result.
So let’s see this tutorial.
Download this VB.Net programming code as required and rename to Module1.vb.
If this was interesting you may be interested in this too.