Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 6796 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post

Link to post
Share on other sites
I can''t tell you whats wrong, but I hate to tell you, you don''t need to put ByRef.
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.

Share this post

Link to post
Share on other sites

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


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


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

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!