Hey

Im fairly new to OO programming in VB and this is my first time trying to create my own events.

What i have so far is simply:

declaration:
VB Code:
  1. Public Event Connected()
routines:
VB Code:
  1. Public Sub SQL_Connect()
  2. On Error GoTo sql_connect_err_handler
  3.     Set cn = New ADODB.Connection
  4.     If cn_string = vbNullString Then Err.Raise CN_STR_NULL
  5.     cn.ConnectionString = cn_string
  6.     cn.Open
  7.     Call Event_Connected
  8.  
  9. Exit Sub
  10. sql_connect_err_handler:
  11. If Err.Number = CN_STR_NULL Then
  12.     RaiseEvent Error(CN_STR_NULL, "", "Connection String Invalid")
  13. Else
  14.     RaiseEvent Error(Err.Number, Err.Source, Err.Description)
  15. End If
  16.  
  17. Private Sub Event_Connected()
  18.     RaiseEvent Connected
  19. End Sub

And on the form:
VB Code:
  1. Public WithEvents NewSql As ClsSQL
  2.  
  3. Private Sub Command1_Click()
  4. Set NewSql = New ClsSQL
  5. End Sub
  6.  
  7. Private Sub NewSql_Connected()
  8.     label1.caption "Connection Active"
  9. End Sub
Tracing the code shows that the connection to db is fine etc etc but it passes through the RaiseEvent call without raising the forms event handler

any ideas?