Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21143

[RESOLVED] What's wrong with this code?

$
0
0
The code works fine when I have this code in the form that is using it.
Code:

Private Function GetPix() As Byte()
CopyMemory Pix(0, 0, 0), ByVal BitsPtr, 4 * PicW * PicH
GetPix() = Pix()
End Function

However when I define it as public and use it in a class like this, I have problems.
Code:

Public Function GetPix() As Byte()
CopyMemory Pix(0, 0, 0), ByVal BitsPtr, 4 * PicW * PicH
GetPix() = Pix()
End Function

Specifically I get this error message when it is called from a form.
Quote:

Compile Error:
Function call on left-hand side of assignment must return Variant or Object
I don't think it should return Variant or Object, because I specifically defined it to return Byte() when I defined the function. Is there something I'm missing here? Are byte arrays not a valid output type for functions that are in classes? Some help here would be nice.

Viewing all articles
Browse latest Browse all 21143

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>