Here are a couple of notes for the VB.NET class I instructed at this week...
(1) Creating a global exception handler for WindowsForms (.NET 1.1): This is a multistep process (note that in .NET 2.0 they give you a global exception handler in Project properties which is nicer). Create a Sub Main module that creates your main form and adds a handler for the Application.ThreadException. In Project Properties, change your startup object to Sub Main. (code below)
Module
SubMain
Public Sub main()
Try
AddHandler Application.ThreadException, AddressOf HandleExceptionEvent
Dim frmMain As New Form1
Application.Run(frmMain)
Catch ex As Exception
HandleException(ex)
End Try
End Sub
Private Sub HandleExceptionEvent(ByVal sender As Object, ByVal e As System.Threading.ThreadExceptionEventArgs)
HandleException(e.Exception)
End Sub
Private Sub HandleException(ByVal ex As Exception)
MsgBox("Sorry, an error has occurred:" & ex.Message)
End Sub
End Module
(2) Creating a TextBox class that handles Enter as Tab key: some users prefer hitting ENTER on each WindowsForms field to "tab" to the next field. We can do this by creating an inhertied textbox and handling its KeyPress event. First create a new Class and then implement as follows
Public Class TextBoxEnterTab
Inherits TextBox
Private Sub TextBoxEnterTab_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
If e.KeyChar = Chr(13) Then
SendKeys.Send("{TAB}")
e.Handled = True
End If
End Sub
End Class
(3) Code Generation Tools: Check out MyGeneration dOOdads and CodeSmith
(4) Miscellaneous tools and utilities for development
VBCommenter - generates comment blocks for VB.NET http://www.gotdotnet.com/team/ide/
NDoc - generates documentation automatically form XML comments http://ndoc.sourceforge.net
NET Reflector - used to disassemble assemblies http://www.aisto.com/roeder/dotnet/
REGEXLIB - an online Regular Expression library to use with the Regular Expression Validator controls http://www.regexlib.com
Enterprise Library - Microsoft's Application Blocks for handling common development tasks http://www.microsoft.com/downloads/details.aspx?familyid=5A14E870-406B-4F2A-B723-97BA84AE80B5&displaylang=en
http://msdn.microsoft.com/library/?url=/library/en-us/dnpag2/html/EntLib2.asp
Atlas http://atlas.asp.net - Microsoft's AJAX library, including Behaviors