Advertisement

arghhhhhhhhhhh CANT FIGURE OUT WHATS WRONG WITH THIS

Started by April 06, 2000 08:45 AM
1 comment, last by HOOKUPS 24 years, 8 months ago
Public Function Calculate(ByRef X As Integer, ByRef Y As Integer) As Integer InputX = X InputY = Y TwipsPerPixel = 15 PixelonScreenX = GetSystemMetrics(SM_CXDOUBLECLK) Select Case PixelonScreenX: Case 1280: ScreenX = 1280 ScreenY = 1024 Case 1024: ScreenX = 1024 * 0.9 ScreenY = 768 * 0.9 Case 800: ScreenX = 800 * 0.9 ScreenY = 600 * 0.9 Case 640: ScreenX = 640 * 0.9 ScreenY = 480 * 0.9 End Select minmaxX = CInt(ScreenX / InputX) minmaxY = CInt(ScreenY / InputY) gridsize = MinMax(minmaxX, minmaxY) X = InputX * gridsize * TwipsPerPixel Y = InputY * gridsize * TwipsPerPixel End Function Function MinMax(MaxX As Integer, MaxY As Integer) As Integer If MaxX < MaxY Then MinMax = MaxX Else MinMax = MaxY End If End Function i get a byref error when i try to use the calculate function hehe ive been lookin at this 4 hours and i cant figure out what im doing wrong heh could someone help me out thanx in advance
I can''t tell you whats wrong, but I hate to tell you, you don''t need to put ByRef.
quote: If you don''t specify either the ByVal or ByRef keyword when passing an argument, your value is sent by reference. The default is ByRef.


That quote is from the MSDN VB help documentation.
Advertisement
Hi

The chances are, whatever variables are in the function call, one or both of them are not integers!

ie

Dim X as Single
Dim Y as Integer

Calculate(X, Y) '' This''ll cause a byref argument mis-match

If this isn''t the answer, post some more code!

Hope this helps

Matt

Check out my project at: www.btinternet.com/~Matthew.Bennett

This topic is closed to new replies.

Advertisement