Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Userform level class instance doesn't recognize methods

Hello,

I have a class (csList) with several properties and methods and I need to
have it "publicly" available within the routines of a userform. When I use
"Public|Private ls As New csList" at the top of the userform code and
reference the methods in any of the userform routines as "ls.method" it tells
me Method or Data Member not found (Autocompletion doesn't recognize them
either). I've also tried removing the New statement and using a "Set ls = New
csList" line in the userform code, but the same thing happened.

What am I doing wrong?
Thanks,
=Ray=
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Userform level class instance doesn't recognize methods

Hi Ray,

With the following everything works as expected, including the intellisense

' code userform1
Private ls As New csList

Private Sub UserForm_Click()
MsgBox ls.propFlag
Me.Caption = ls.fncTest
End Sub

Private Sub UserForm_Initialize()
ls.propFlag = True
End Sub

' code in csList
Dim bFlag As Boolean

Public Property Let propFlag(b As Boolean)
bFlag = b
End Property

Public Property Get propFlag() As Boolean
propFlag = bFlag
End Property

Public Function fncTest() As String
fncTest = CStr(bFlag)
End Function

Run the form and click on it

(first letter in "ls" is lower case L, not an upper i or number one, which I
first suspected might be the problem)

Regards,
Peter T


"=Ray=" wrote in message
...
Hello,

I have a class (csList) with several properties and methods and I need to
have it "publicly" available within the routines of a userform. When I use
"Public|Private ls As New csList" at the top of the userform code and
reference the methods in any of the userform routines as "ls.method" it

tells
me Method or Data Member not found (Autocompletion doesn't recognize them
either). I've also tried removing the New statement and using a "Set ls =

New
csList" line in the userform code, but the same thing happened.

What am I doing wrong?
Thanks,
=Ray=



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Userform level class instance doesn't recognize methods

Thank you for your effort.

Silly me, all my class routines were private! (I taught myself VBA a few
years ago, and I haven't done much with it since then, and I guess I've
gotten rusty!)

=Ray=

"Peter T" wrote:

Hi Ray,

With the following everything works as expected, including the intellisense

' code userform1
Private ls As New csList

Private Sub UserForm_Click()
MsgBox ls.propFlag
Me.Caption = ls.fncTest
End Sub

Private Sub UserForm_Initialize()
ls.propFlag = True
End Sub

' code in csList
Dim bFlag As Boolean

Public Property Let propFlag(b As Boolean)
bFlag = b
End Property

Public Property Get propFlag() As Boolean
propFlag = bFlag
End Property

Public Function fncTest() As String
fncTest = CStr(bFlag)
End Function

Run the form and click on it

(first letter in "ls" is lower case L, not an upper i or number one, which I
first suspected might be the problem)

Regards,
Peter T


"=Ray=" wrote in message
...
Hello,

I have a class (csList) with several properties and methods and I need to
have it "publicly" available within the routines of a userform. When I use
"Public|Private ls As New csList" at the top of the userform code and
reference the methods in any of the userform routines as "ls.method" it

tells
me Method or Data Member not found (Autocompletion doesn't recognize them
either). I've also tried removing the New statement and using a "Set ls =

New
csList" line in the userform code, but the same thing happened.

What am I doing wrong?
Thanks,
=Ray=




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generic Userform class RB Smissaert Excel Programming 3 October 22nd 05 04:39 PM
refedits in a userform control class Doug Glancy Excel Programming 10 June 3rd 05 10:39 PM
Userform doesn't recognize other user form upon re-load Cheryl Excel Programming 1 August 20th 04 10:43 PM
Class Instance Identifier Chip Pearson Excel Programming 6 June 29th 04 09:34 AM
"Static" Methods in Class Modules Ripan[_3_] Excel Programming 2 January 12th 04 04:55 PM


All times are GMT +1. The time now is 08:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"