Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object variable or with block variable not set

Status
Not open for further replies.

jack1080

Programmer
Jun 2, 2007
34
0
0
MY
I have a form named form1 with one control on it, it is a label named label1
I have a class named Class1.

Followed is the code of form 1 and Class1
form1
====
Option Explicit
Dim cls1 As New Class1

Private Sub Form_Activate()
cls1.setLbl Me.Label1
cls1.test
End Sub

Class1
=====
Dim lbl As Label
Public Sub test()
MsgBox "hello"
Label1.Caption = "test"
End Sub

Public Sub setLbl(lbl1 As Label)
lbl = lbl1
End Sub


When I open form, it prompts me
Run-time error '91':
Object variable or with block variable not set

What is the problem and how to correct it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top