VB runs its main event loop via the screens form load function as in the majority of the earlier MS Visual Studio products.
http://en.wikipedia.org/wiki/Visual_basic#Example_code
I've used MS VB 1.0 for DOS and several other MS VS products up to version 6.0 (and MS Visual c++ Express). I must say that I gained a better understanding of how the event loop operates from looking at how dbFast, a 16 bit compiled xbase for windows from the early to mid 1990's handled things. The following code shows the basic process, including screen controls, of 4 different ways to trigger the same event. It's good to see how all the code works inline without having the overall basic structure obfuscated by the screen designer.
Code:
* main program loop
* Declare public variables, menu's, screen objects etc
CREATE POPUP MENU '@Exit' from 'E@xit program
CREATE BUTTON "Exit" AT 21,66 SIZE 1,10 PLAIN'
sAction = '?' *: Init sAction to something so it is not empty
DO WHILE .NOT. EMPTY(sAction) * Main Event Loop
UPDATE CONTROL ALL * Refresh screen controls
READ SAVE * wait for an event to occur i.e. after form load is run
nEvent = Event() * Event type i.e. pulldown menu (cursor), button (cursor) or keypress
nTheMenu = HMENU() * if selected, the pulldown menu number
nTheOption = VMENU() * if selected, the pulldown menu option
nTheKey = LASTKEY() * if a key was pressed, that key code
sTheButton = BUTTON() * if a button was clicked, that button name
sAction = _Translate(nEvent) * translate event type to determine the action
DO _Action * do the translated action
ENDDO
RETURN
*****************************
FUNCTION _Translate()
*****************************
PARAMETER nTheEvent
PRIVATE sTheAction
sTheAction = ' '
DO CASE
CASE nTheEvent = eClose * window close button
sTheAction = 'Done'
CASE nTheEvent = eMenu * dropdown menu
DO CASE
CASE HMENU()=1
DO CASE
CASE VMENU()=1
sTheAction = 'Done'
ENDCASE
ENDCASE
CASE nTheEvent = eButton * Button
DO CASE
CASE sTheButton = 'Exit'
sTheAction = 'Done'
ENDCASE
CASE nTheEvent = eKey * Key
DO CASE
CASE nTheKey = 27 * Esc pressed
sTheAction = 'Done'
ENDCASE
OTHERWISE
sTheAction = '?'
ENDCASE
RETURN(sTheAction)
*****************************
PROCEDURE _Action
*************************
DO CASE
CASE sAction = 'Done'
sAction = ''
ENDCASE
RETURN