You add code to a module, or the declaration section of your form, then then call it from a Form.

The only thing you need in your form is
VB Code:
  1. Private Sub Form_Load()
  2. SetRegValue HKEY_LOCAL_MACHINE, _
  3. "Software\Microsoft\Windows\CurrentVersion\Run", "NotePad", "c:\windows\notepad.exe"
  4. End Sub
Where the .exe is the name of your program.