Hello everyone, i am having trouble with this little piece of code I found from one of Lavolpe's thread in this forum.
The problem is when i try to use a variable (Long) and pass it instead of using numbers (10&).
Command1 will error, but Command2 works, why is that? Or how can i fix this so it works?? I tried passing it ByVal, no difference still error.
Here is my code.
The problem is when i try to use a variable (Long) and pass it instead of using numbers (10&).
Command1 will error, but Command2 works, why is that? Or how can i fix this so it works?? I tried passing it ByVal, no difference still error.
Here is my code.
Code:
Private ThePic As StdPicture
Private Sub Form_Load()
Set ThePic = LoadPicture("C:\Users\Wal-Mart\Desktop\Untitled.jpg")
End Sub
Private Sub Command1_Click()
Static XX As Long
Static YY As Long
XX = XX + 10
YY = YY + 10
With ThePic
.Render Me.hDC Or 0&, XX, YY, ScaleX(.Width, vbHimetric, vbPixels), ScaleY(.Height, vbHimetric, vbPixels), _
0&, .Height, .Width, -.Height, ByVal 0&
End With
End Sub
Private Sub Command2_Click()
With ThePic
.Render Me.hDC Or 0&, 10&, 10&, ScaleX(.Width, vbHimetric, vbPixels), ScaleY(.Height, vbHimetric, vbPixels), _
0&, .Height, .Width, -.Height, ByVal 0&
End With
End Sub