Develop for Windows 7

Have you any plans on starting to develop applications for Windows 7 yet? The Windows API Code Pack can be used to access some of the new features in Win7, but also some existing features in older version of the Windows OS. The team at Microsoft that are behind the code pack have just updated all the sample code so they now come in both VB as well as in C#, and they did a very good job with it too. So go have a look, it’s pretty neat. Have fun.

At your service (part II) – ASMX Web Service vs WCF

Introduction Last time I demonstrated how to develop a Windows Communication Foundation (WCF) service. This time we’re going to look at the differences between a ASP.Net WebService and a WCF service. The biggest difference between them is probably that a WebService only can be activated via HTTP and they are tightly coupled with ASP.Net HTTP pipeline. A WCF service on the other hand can be bound to a large variety of network protocols. It also doesn’t require that it is hosted on a web server, it can be hosted in a console application, in a Windows Forms app, or in … Continue reading At your service (part II) – ASMX Web Service vs WCF

At your service (part I) – WCF tutorial in VB

Introduction In this post I’m going to do a tutorial on Windows Communication Foundation, WCF. This tutorial is divided in 4 steps: Defining the WCF data and service contracts. Implementing the WCF service contract. Creating the service-host application. Create a client application that uses the service. So without further ado, let’s get busy. Here is where we are getting busy We’re going to implement our WCF server as a simple console application so start Visual Studio and create a new Console project. But for now we just leave the Sub Main() empty, since we implement the server in step 3. … Continue reading At your service (part I) – WCF tutorial in VB

Debugging a Windows Service

Introduction In my last article I showed a simple example of how to create a Windows Service using VB. This time we’re going to have a look at how to debug the service from Visual Studio. Since a service must run from the context of the Service Control Manager you can’t normally debug it in the same manner as you would any other project type. Normally you would need to build the project, install it using the InstallUtil.exe command line tool, and attach a debugger to the process while it’s running. Another approach is to create a separate project (console … Continue reading Debugging a Windows Service

Creating a Windows Service using VB.Net

Introduction Yesterday I got a call from my brother, or actually he sent me a message over MSN. He wanted to know if I could help him create a program with a very specific requirement. Where he works they have a system that creates a lock file when you enter a new journal into the system. However because of a bug (?) in that system, this file is not always deleted after the journal have been entered. If this file is not removed, no more journals can be entered and the system runs amok. So my brother wanted a program … Continue reading Creating a Windows Service using VB.Net

Event horizon – Understanding custom events

Introduction In this article I’m going to try to explain what custom events are and why you should use them in your code. As you will see the term custom event in this context is not just an event you have created for your own class, but also a custom way of storing the delegates for this event. Most of this article is intended for the VB developer, but with the exception of VB specific parts, especially found in the Background Info section, the information here also applies to C# (but with a slightly different syntax of course). Background info … Continue reading Event horizon – Understanding custom events

Run you later – Understanding deferred execution in LINQ

Introduction In this article I’m going to try to explain one of the most misunderstood features of LINQ – deferred execution – and the impact it might have on your code if you don’t fully understand what it means. What does deferred execution mean? According to the dictionary the word deferred means delayed or postponed. So deferred execution in LINQ means that the actual execution of a query is postponed to a later time. Let’s say that you’re using LINQ to SQL and want to use the following LINQ query: Dim cheapProducts = From p In db.Products _ Where p.ListPrice … Continue reading Run you later – Understanding deferred execution in LINQ

The Untouchables (part III) – Adding iterators to our immutable stack

Introduction In my last post I showed you a VB translation of Eric Lippert’s immutable stack class. There was however one thing that was lost in translation. In Eric’s original code he made the class enumerable (added support for a For Each loop). Because C# has support for iterators with its yield keyword, that was very easy to do… in C#. VB currently doesn’t have this feature so to add the same support we need to implement both the IEnumerable(Of T) and the IEnumerator(Of T), which in turn requires the implementation of the non-generic IEnumarable and IEnumerator and also the … Continue reading The Untouchables (part III) – Adding iterators to our immutable stack

The Untouchables (part II) – Creating an Immutable stack with VB

Introduction In this article I will shamelessly “steal” the great work originally posted by Eric Lippert on his blog. However I will translate his code into VB and try to explain it from a VB developers point of view. In my last post, I described what immutable objects are and what the advantage of using them would be. It also described how you could create an immutable class and use it as if it was value type. This time we are going to take this a step further and create an immutable stack. An immutable stack, is that possible? As … Continue reading The Untouchables (part II) – Creating an Immutable stack with VB

The Untouchables – Creating Immutable objects with VB

There are many articles available on the Internet about immutable objects in .Net. Unfortunately almost all of them are addressed toward C# developers. In this article I’m going to rectify that by providing some information on the subject aimed toward the VB developer. Immutable objects are a very simple yet powerful concept within programming. An object is immutable if its state cannot change after it has been created, which means that all its members need to be read-only. The integer number 1, for example, is an immutable number. There is nothing you can do that changes it. You can’t make … Continue reading The Untouchables – Creating Immutable objects with VB