Solved

How to set Object to Nothing ?

Posted on 2006-06-13
7
202 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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month9 days, 23 hours left to enroll

623 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