PraveenMenon
Programmer
Helo All,
I am having a problem with generalising the following piece of code. I need it as a function, so that i can call it with different arguments.
===========================================================
with Img1
Load Img1((.UBound) + 1)
Img1(.UBound).Picture = Source.Picture
Img1((.UBound)).Visible = True
If (.UBound) = 1 Then
Img1((.UBound)).Move 0, 0
Else
If ((.UBound)) Mod 3 = 1 Then
Img1((.UBound)).Move 0, Img1((.UBound) - 1).Top + Img1((.UBound) - 1).Height
Else
Img1((.UBound)).Move Img1((.UBound) - 1).Left + Img1((.UBound) - 1).Width, Img1((.UBound) - 1).Top
End If
End If
End with
===========================================================
My idea was to write this in a function, and give arguments, so that i can call it like this.
I tried this
===========================================================
Function PopPicBox(Img1() As Image, ImgSource As Control)
Load Img1((Img1.UBound) + 1)
Img1(Img1.UBound).Picture = Source.Picture
Img1((Img1.UBound)).Visible = True
If (Img1.UBound) = 1 Then
Img1((Img1.UBound)).Move 0, 0
Else
If ((Img1.UBound)) Mod 3 = 1 Then
Img1((Img1.UBound)).Move 0, Img1((Img1.UBound) - 1).Top + Img1((Img1.UBound) - 1).Height
Else
Img1((Img1.UBound)).Move Img1((Img1.UBound) - 1).Left + Img1((Img1.UBound) - 1).Width, Img1((Img1.UBound) - 1).Top
End If
End If
End Function
===========================================================
===========================================================
and call it like this
popPicBox Img1(),Image1
===========================================================
This is not working...
It says "Array or User Defined Type Expected"
Can experts suggest an idea?
Thanks In advance All the Best
Praveen Menon
pcmin@rediffmail.com
I am having a problem with generalising the following piece of code. I need it as a function, so that i can call it with different arguments.
===========================================================
with Img1
Load Img1((.UBound) + 1)
Img1(.UBound).Picture = Source.Picture
Img1((.UBound)).Visible = True
If (.UBound) = 1 Then
Img1((.UBound)).Move 0, 0
Else
If ((.UBound)) Mod 3 = 1 Then
Img1((.UBound)).Move 0, Img1((.UBound) - 1).Top + Img1((.UBound) - 1).Height
Else
Img1((.UBound)).Move Img1((.UBound) - 1).Left + Img1((.UBound) - 1).Width, Img1((.UBound) - 1).Top
End If
End If
End with
===========================================================
My idea was to write this in a function, and give arguments, so that i can call it like this.
I tried this
===========================================================
Function PopPicBox(Img1() As Image, ImgSource As Control)
Load Img1((Img1.UBound) + 1)
Img1(Img1.UBound).Picture = Source.Picture
Img1((Img1.UBound)).Visible = True
If (Img1.UBound) = 1 Then
Img1((Img1.UBound)).Move 0, 0
Else
If ((Img1.UBound)) Mod 3 = 1 Then
Img1((Img1.UBound)).Move 0, Img1((Img1.UBound) - 1).Top + Img1((Img1.UBound) - 1).Height
Else
Img1((Img1.UBound)).Move Img1((Img1.UBound) - 1).Left + Img1((Img1.UBound) - 1).Width, Img1((Img1.UBound) - 1).Top
End If
End If
End Function
===========================================================
===========================================================
and call it like this
popPicBox Img1(),Image1
===========================================================
This is not working...
It says "Array or User Defined Type Expected"
Can experts suggest an idea?
Thanks In advance All the Best
Praveen Menon
pcmin@rediffmail.com