PC Review


Reply
Thread Tools Rate Thread

class question - code included in this post

 
 
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
 
      26th Mar 2004
Sorry I forgot the code (Please see below). The first time that I call this class, I populate colScrollArea. The second time that I call this class, it, for some reason that I don't see, destroys colScrollArea. Does anyone have any ideas

I am using XL 2002

TIA

Jo

Code

Private Sub Class_Initialize(
Set m_f = New frmSecurit
If colScrollArea Is Nothing The
Call populateScrollAreaCollectio
End I
End Su

Private Sub Class_Terminate(
Unload m_
Set colScrollArea = Nothin
Set m_f = Nothin
End Su

populateScrollAreaCollection is a public sub in a module and has the following code

Public Sub populateScrollAreaCollection(
Set colScrollArea = New Collectio
With colScrollAre
.Add WKS_SA_MAIN, WKS_MAI
.Add WKS_SA_ECHO, WKS_ECH
.Add WKS_SA_CATH, WKS_CAT
.Add WKS_SA_NUCLEAR, WKS_NUCLEA
.Add WKS_SA_OTHER, WKS_OTHE
.Add WKS_SA_PACS, WKS_PAC
.Add WKS_SA_SYSTEM, WKS_SYSTE
.Add WKS_SA_REVIEW, WKS_REVIE
.Add WKS_SA_NETWORK, WKS_NETWOR
.Add WKS_SA_RESULTS, WKS_RESULT
End Wit
End Su

where colScrollArea is declared as

Public colScrollArea As Collectio


 
Reply With Quote
 
 
 
 
onedaywhen
Guest
Posts: n/a
 
      29th Mar 2004
Seems to work for me. Perhaps there is code elsewhere (e.g. in
frmSecurity) that is having an effect? Here's my test, stripped down
to the essentials of what your posted:

'----------------------------------
'<Code in class module named Class1>
Option Explicit

Private Sub Class_Initialize()
If colScrollArea Is Nothing Then
Stop ' hard breakpoint

' Next line only fires once (correct)
Call populateScrollAreaCollection
End If
End Sub

Private Sub Class_Terminate()
Set colScrollArea = Nothing
End Sub
'</Code in class module named Class1>
'----------------------------------
'<Code in a standard module>
Option Explicit

Public colScrollArea As Collection

Sub populateScrollAreaCollection()
Set colScrollArea = New Collection
End Sub

Sub Test()
Dim c1 As Class1
Dim c2 As Class1

Set c1 = New Class1
Set c2 = New Class1
End Sub
'</Code in a standard module>
'----------------------------------

--

Joe <(E-Mail Removed)> wrote in message news:<1B7DD63E-F2D7-4BF6-A0A6-(E-Mail Removed)>...
> Sorry I forgot the code (Please see below). The first time that I call this class, I populate colScrollArea. The second time that I call this class, it, for some reason that I don't see, destroys colScrollArea. Does anyone have any ideas?
>
> I am using XL 2002.
>
> TIA,
>
> Joe
>
> Code:
>
>
> Private Sub Class_Initialize()
> Set m_f = New frmSecurity
> If colScrollArea Is Nothing Then
> Call populateScrollAreaCollection
> End If
> End Sub
>
> Private Sub Class_Terminate()
> Unload m_f
> Set colScrollArea = Nothing
> Set m_f = Nothing
> End Sub
>
> populateScrollAreaCollection is a public sub in a module and has the following code:
>
> Public Sub populateScrollAreaCollection()
> Set colScrollArea = New Collection
> With colScrollArea
> .Add WKS_SA_MAIN, WKS_MAIN
> .Add WKS_SA_ECHO, WKS_ECHO
> .Add WKS_SA_CATH, WKS_CATH
> .Add WKS_SA_NUCLEAR, WKS_NUCLEAR
> .Add WKS_SA_OTHER, WKS_OTHER
> .Add WKS_SA_PACS, WKS_PACS
> .Add WKS_SA_SYSTEM, WKS_SYSTEM
> .Add WKS_SA_REVIEW, WKS_REVIEW
> .Add WKS_SA_NETWORK, WKS_NETWORK
> .Add WKS_SA_RESULTS, WKS_RESULTS
> End With
> End Sub
>
> where colScrollArea is declared as
>
> Public colScrollArea As Collection

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can someone tell me where to post a code question for the following jbonifacejr Microsoft VB .NET 2 1st May 2007 08:06 AM
Chart Class Module/follow on question to hyperlink post earlier. =?Utf-8?B?Um9taW5hbGw=?= Microsoft Excel Charting 2 7th Mar 2007 02:43 AM
Code Question -Second Post Rick@aol.com Microsoft VB .NET 1 16th Dec 2006 12:19 PM
Can anyone help with this? Original thread included...last post is question. kaiser Microsoft Outlook VBA Programming 1 6th Nov 2005 09:10 AM
Http Post of XML works through Code Behind but fails through Class =?Utf-8?B?VGVybWluYXRvcnM=?= Microsoft Dot NET Framework 0 4th Aug 2004 01:31 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:21 AM.