Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default let and get in class module

With help from Bullen, Green, Bovey and Rosenberg, I've created the
following class module. It does what I want, i.e., allows me to read and
write the "face up" property of "cards", which are images on a userform.
However, I had to use 3 different variations on "face up" to get it to
work - the property, "face_up," the Let variable "fac_up" and the variable
to pass the state to the Get property, "fac3_up."

Is there a way to do it with one variable instead of two?

Option Explicit

Public WithEvents card As MSForms.Image
Private fac3_up As Boolean

Private Sub Card_Click()

Property Let face_up(fac_up As Boolean)
If fac_up = True Then
card.Picture = ConcentrationForm.birds.Controls("birds1").Picture
fac3_up = True
Else
card.Picture = ConcentrationForm.birds.Controls("birdsback").Pict ure
fac3_up = False
End If
End Property

Property Get face_up() As Boolean
face_up = fac3_up
End Property

End Sub

Thanks,

Doug Glancy


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default let and get in class module

Doug,

That is one variable, one property and one argument.

There isn't really another way if you want to act with a Let and Get, as
opposed to just a straight read/write property which could then be

Public Property face_up As Boolean.

You have to have that variable to work with within the class, and you have
to be able to expose it to the world via the property, it just so happens
that with a straight read/write property that can all be done in one
statement.

Personally, in the argument, I always try and use a name that is different
to the property but contains it's meaning, so as to be explicit, like

Property Let face_up(birds1 As Boolean)
etc.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Doug Glancy" wrote in message
...
With help from Bullen, Green, Bovey and Rosenberg, I've created the
following class module. It does what I want, i.e., allows me to read and
write the "face up" property of "cards", which are images on a userform.
However, I had to use 3 different variations on "face up" to get it to
work - the property, "face_up," the Let variable "fac_up" and the variable
to pass the state to the Get property, "fac3_up."

Is there a way to do it with one variable instead of two?

Option Explicit

Public WithEvents card As MSForms.Image
Private fac3_up As Boolean

Private Sub Card_Click()

Property Let face_up(fac_up As Boolean)
If fac_up = True Then
card.Picture = ConcentrationForm.birds.Controls("birds1").Picture
fac3_up = True
Else
card.Picture = ConcentrationForm.birds.Controls("birdsback").Pict ure
fac3_up = False
End If
End Property

Property Get face_up() As Boolean
face_up = fac3_up
End Property

End Sub

Thanks,

Doug Glancy




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default let and get in class module

"Doug Glancy" wrote ...

With help from Bullen, Green, Bovey and Rosenberg, I've created the
following class module. It does what I want, i.e., allows me to read and
write the "face up" property of "cards", which are images on a userform.
However, I had to use 3 different variations on "face up" to get it to
work - the property, "face_up," the Let variable "fac_up" and the variable
to pass the state to the Get property, "fac3_up."

Is there a way to do it with one variable instead of two?


Suggestion:

Option Explicit

Public WithEvents card As MSForms.Image
Private fac3_up As Boolean

Private Sub Card_Click()
Flip
End Sub

Private Sub Flip()

fac3_up = Not fac3_up

If fac3_up Then
card.Picture = ConcentrationForm.birds.Controls("birds1").Picture
Else
card.Picture = ConcentrationForm.birds.Controls("birdsback").Pict ure
End If

End Sub

Public Property Get face_up() As Boolean
face_up = fac3_up
End Property

Jamie.

--
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default let and get in class module

Thanks, Bob and Jamie for the clarification and suggestions.

Doug


"Jamie Collins" wrote in message
om...
"Doug Glancy" wrote ...

With help from Bullen, Green, Bovey and Rosenberg, I've created the
following class module. It does what I want, i.e., allows me to read

and
write the "face up" property of "cards", which are images on a userform.
However, I had to use 3 different variations on "face up" to get it to
work - the property, "face_up," the Let variable "fac_up" and the

variable
to pass the state to the Get property, "fac3_up."

Is there a way to do it with one variable instead of two?


Suggestion:

Option Explicit

Public WithEvents card As MSForms.Image
Private fac3_up As Boolean

Private Sub Card_Click()
Flip
End Sub

Private Sub Flip()

fac3_up = Not fac3_up

If fac3_up Then
card.Picture = ConcentrationForm.birds.Controls("birds1").Picture
Else
card.Picture = ConcentrationForm.birds.Controls("birdsback").Pict ure
End If

End Sub

Public Property Get face_up() As Boolean
face_up = fac3_up
End Property

Jamie.

--



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
CLASS MODULE & SIMPLE MODULE FARAZ QURESHI Excel Discussion (Misc queries) 1 September 7th 07 09:32 AM
Class Module Todd Huttenstine Excel Programming 2 May 21st 04 11:17 PM
Class module Mark[_36_] Excel Programming 2 February 17th 04 03:14 PM
Class module David Excel Programming 4 December 31st 03 01:58 PM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM


All times are GMT +1. The time now is 07:13 PM.

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"