Solved

How to set Object to Nothing ?

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb6 programatically bring window to front 8 72
Crystal reports - Formula Field code need assistance with code 17 75
TT Auto Dashboard 13 92
Sub or Function is not defined 6 31
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

831 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