Link to home
Start Free TrialLog in
Avatar of b_harpal
b_harpal

asked on

How to set Object to Nothing ?

Hi,

I have a program which shows the results with the pictures. To do this I have used listboc control and a third party control from Neo components Scroller II Library, ScrollerII.ocx
I get the results, say, 5 records. But when I do a new search, the previous list is still there and new records get appended to the list. It should remove the old list and show the new list. But this doesn not happen.

Private Sub Command3_Click()
 Ctl_VGList.ImageList = Nothing
'        '----Remove All previous values from Image List
'        For i = ImageList1.ListImages.Count - 1 To 1 Step -1
'            ImageList1.ListImages.Remove i
'        Next
End Sub


Runtime error 450
Wrong number of arguments or Invalid property assignment
at this line  Ctl_VGList.ImageList = Nothing.

Any ideas ?

If required I will post the full code here...

Regards

hs

ASKER CERTIFIED SOLUTION
Avatar of pradapkumar
pradapkumar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kaliyugkaarjun
kaliyugkaarjun

In VB 6.0, As New and Nothing keywords are used to declare an object and initializes the object.

U need to use Set keyword to delete Ctl_VGList as Ctl_VGList is  an object. Using set keyword the program obtains reference to Ctl_VGList and deletes it safely.
No reply from author????
No response from the author ???? though explanation was given to the question..