Thursday, June 20, 2013

How to use a DLL in ASP.NET page using Microsoft Visual Web Developer Express

So you've created a DLL assembly for shared code (perhaps using Microsoft Visual Basic Express or some other), and you want to use it on your website, accessing a public class from the DLL. This is how I did it in Microsoft Visual Web Developer 2010 Express edition...

STEP 1: Add a reference to the DLL to your website.

  1. In Solution Explorer, select your Web project.
  2. On the Website menu (for Web site projects) or the Project menu (for Web application projects), choose Add Reference. Alternatively, you can right-click the name of your Web project in Solution Explorer and then select Add Reference.
    The Add Reference dialogue box is displayed.
  3. Select the Browse tab.
  4. Browse to the folder that contains the assembly you want to reference, select the assembly, and then click OK.

    Adding a reference in this way ensures that all file dependencies (debug files, XML document files, and so on) are copied.

STEP 2: Use the public class from the DLL on you page

Use Imports to utilize the namespace from your DLL, then simply use Dim and New to instantiate a new object using a public class from the DLL. ie:

Imports MyDLLNameSpace

Dim myObject As New dllPublicClass 

If you just use the Dim statement Visual Web Developer should prompt you to add the Imports statement.


Wednesday, June 12, 2013

Managing Windows Printer Drivers (Updating, Removing, etc)

Strangely, for all my years of Windows experience, I have only just discovered the Print Management administration console :O I recently had a problem where different users/computers had different drivers for the same printer, and some drivers worked, some didn't. So how do you check which version of the driver is installed on the computer or on the print server? And how do you update them or remove them etc? The answer is: use Print Management.

This page from Microsoft has instructions for managing printers and printer servers on Windows 7 and Windows 2008 R2:

In particular, this link has instruction for managing the printer drivers, including instructions for adding, updating and removing drivers (again, the instructions are particularly for Windows 7 and Windows 2008 R2, but the instructions are pretty much the same for Windows XP and Windows 2003 R2):

Here are some screenshots showing where to find the Print Management icon in Administrative Tools (and you can get to Administrative Tools from the Control Panel), in both Windows 2003 R2 and Windows 7...

Once you are in the Print Management interface you can see all the Driver version numbers, and by right-clicking on a driver you can update or delete the drivers. I especially needed to do this to update the 64-bit driver on a 32-bit server. Using the normal Printer Properties interface only updated the 32-bit version of the drivers, and once I went into Print Management I discovered that the 64-bit versions were still the old ones.

(PS: The particular problem I had was with Kyocera drivers. Maybe just me, but I haven't had good experiences with this brand. I prefer HP all the way. I have used Toshiba multifunction printer/copiers, and they have generally been ok, but driver support also has sometimes had issues.)