|
-
Aug 18th, 2000, 11:19 AM
#1
Thread Starter
Hyperactive Member
Hi,
On my form I have a image control Image1 and picturebox control Picture1.
I seem to have trouble with 'Optional' keyword and IsMissing() intristic function.
As I understand it, when I declare a sub with an 'Optional argument',
I don't have to pass that variable at all. Then I can use IsMissing() function
to check if the argument was passed or not.
But that doesn't work. Whenever I use (see code below):
MySub Image1
----- or -----
MySub Image1, Picture1
I get the same results "Picture box is included"
CODE:
'-----------------------------------------------------------
Private Sub MySub(img As Image, Optional pic As PictureBox)
If IsMissing(pic) Then
MsgBox "PictureBox is missing"
Else
MsgBox "Picturebox is included"
End If
End Sub
'-----------------------------------------------------------
Private Sub command1_Click()
MySub Image1
End Sub
'-----------------------------------------------------------
Can anyone explain it to me?
Your help is much appreciated.
-
Aug 18th, 2000, 11:59 AM
#2
transcendental analytic
You can only use ismissing with variants, you can pass pictureboxes in the variant but instead, i suggest that use
Code:
If pic Is nothing then
Instead
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|