Solved

How to set Object to Nothing ?

Posted on 2006-06-13
7
198 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

726 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