axnst2
asked on
"Object variable or With block variable not set"
I am trying to call a simple class module sub with a command button. When I do that I get the error. However, it compiles fine.
Here is the code from the form:
Private Sub Connect_Click()
Dim myLaser As CLaser
myLaser.Connect
End Sub
Here is the code from the class:
Public Sub Connect()
Dim Number As String
Number = GetLaserServerIP
FLaserTestApp.Text1.Text = SetIP(Number)
End Sub
I think my problem is really the way I call the connect function from the form. I am not sure what's wrong. Please help me.
Thanks,
axnst2
Here is the code from the form:
Private Sub Connect_Click()
Dim myLaser As CLaser
myLaser.Connect
End Sub
Here is the code from the class:
Public Sub Connect()
Dim Number As String
Number = GetLaserServerIP
FLaserTestApp.Text1.Text = SetIP(Number)
End Sub
I think my problem is really the way I call the connect function from the form. I am not sure what's wrong. Please help me.
Thanks,
axnst2
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad I could help.
Thanks for the 'A' :)
Thanks for the 'A' :)
try changing to this:
Private Sub Connect_Click()
Dim myLaser As New CLaser '''' MODIFIED
myLaser.Connect
End Sub
bkt