Solved

How to set Object to Nothing ?

Posted on 2006-06-13
7
193 Views
Last Modified: 2013-12-25
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

0
Comment
Question by:b_harpal
  • 2
  • 2
7 Comments
 
LVL 9

Accepted Solution

by:
pradapkumar earned 100 total points
ID: 16900484
why don't you use

Ctl_VGList.Clear method

if you wish to assign nothing to your object then u need to use Set key word infront of it.

Try this one

Set Ctl_VGList = Nothing

the above will work definitely.
0
 
LVL 8

Expert Comment

by:kaliyugkaarjun
ID: 17022729
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.
0
 
LVL 9

Expert Comment

by:pradapkumar
ID: 17024090
No reply from author????
0
 
LVL 8

Expert Comment

by:kaliyugkaarjun
ID: 17293899
No response from the author ???? though explanation was given to the question..
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now