Jumat, 07 Maret 2014

[MS_AccessPros] Wrapper for procedure call with optional arguments

 

I am trying to write a wrapper that calls a form's move method. That method
takes one required and three optional arguments:

Move(Left, Optional Top, Optional Width, Optional Height)

This is in the context of a class that has a form as one of its members.

Let's say I have instantiated an object of this class as oMyForm. Right now
I can move the form this way

oMyForm.Form.move xxx, [yyy], [www],[ hhh]

I am writing the wrapper so that the call will look like this

oMyForm.move xxx, [yyy], [www],[ hhh]

This is what I have so far in the class. Mfrm is th internal private form
variable

Public Sub Move(Left As Long, Optional Top As Variant, Optional Width As
Variant, Optional Height As Variant)

' Procedure: move

' DateTime: 3/7/2014 9:51:46 AM

' Author: Glenn Lloyd

' Description: call the form's move method to position it

'--

Const cstrProcedure = "move"

On Error GoTo HandleError

100 mfrm.Move Left

'what if the call includes one or more of the optional arguments

HandleExit:

Exit Sub

HandleError:

ErrorHandle Err, Erl(), cstrModule & "." & cstrProcedure

Resume HandleExit

End Sub

I am stuck at the line that I have labeled 100. How do I respond to the
various possible combinations of the optional arguments?

Glenn Lloyd

Sudbury Training

(705)805-6712 | Fax (705)805-805-0696| Text (705)885-5283

www.SudburyTraining.com <http://www.sudburytraining.com/>

LogoHoriz

[Non-text portions of this message have been removed]

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
.

__,_._,___

Tidak ada komentar:

Posting Komentar