Archive for the 'VB.NET' Category
DELETE button not captured by KeyPress event
June 17th, 2010A small but important thing – if you want to capture pressing the DELETE button in a WinForms project, you’ll need to do it in the KeyDown or KeyUp event, not the KeyPress event. As the documentation (here and here) points out, KeyPress deals mostly with character keys, and non-character keys won’t raise it.
Remove items from Visual Studio Recent Projects list
May 19th, 2010Here are a couple handy links describing how to remove items from the Recent Projects list on the Visual Studio start page. Basically, in versions prior to VS2010, it’s a registry hack (I’ve read that VS2010 provides a way to do this within the IDE, but I haven’t played with 2010 yet so I can’t [...]
Working with winmm.dll to play audio files in .NET
April 29th, 2010I’m working on a little utility application that will transfer audio files from a recorder to a computer drive. Part of the functionality is to display the audio files, and let users listen to a little snippet of the audio file if they so desire. A quick google search led me to this page containing [...]
DataGridViewComboBox Column Properties
April 26th, 2010I am copying this verbatim from a post I found by Kevin Spencer which is the clearest explanation I have seen of the main properties of a DataGridViewComboBox. It’s here for my reference. Yay if it helps you too!
The DataGridView itself has a DataSource property that determines what columns are in it. The [...]
How to Query SQL Server Role Members
March 17th, 2010You can use SQL Server Database Roles to control access to various parts of your application. Let’s say I have created a .NET application. I have a menu called Administration and I only want certain users to be able to see the menu. One way to do this is to use Active [...]
Accessing a digital camera through a dialog box in .NET
January 12th, 2009A client has asked us to write a little Windows Forms app that will take the pictures on a digital camera and transfer them to a folder on the hard drive. No sweat, we thought – it’s very easy to transfer files and folders using the System.IO namespace – files on devices will surely function [...]
Find First Day of Month, Last Day of Month, etc
November 26th, 2008Today I was writing some code where I needed to calculate the end of the month for a certain date. As per usual, I Googled, and found various examples, some using old VB functions, some using methods of the Date object, some very involved and using lots of string manipulation and converting of things from [...]
Get Max Number from Datatable using the Compute method
July 9th, 2008This is a nifty little thing I came across recently. I wanted to get the maximum value of a number field from a datatable, and learned about the Datatable’s Compute method. It’s really easy to use. The method takes two arguments – an expression argument, which is the aggregate expression you want to use (Count, Max, [...]
Use Generic Methods to create a Session Wrapper class
December 26th, 2007Getting values out of session in ASP.NET can be a bit of a pain for two reasons:
You have to remember what you named the value when you put it in
You have to type cast the value, as session stores it in an Object
One nice way to handle this is to build a wrapper class to [...]
Determine Previous WizardStep using Wizard’s GetHistory Method
October 29th, 2007 Recently I was working on a project that contained an ASP.NET Wizard Control. The control was configured to allow non-linear progression through the WizardSteps. I realized that I needed to know which step the user had been on previously, as that would determine which control would have focus in the current step.
So [...]