The one thing that you'd need to add to the code that dunfiddlin posted is a Handles clause to the button1_Click. It is obviously intended to be a handler for the Click event of 'button1' so you would add 'Handles button1.Click' to the method declaration.