Jump to content
  • Advertisement

Archived

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

EdwardD

Problems with VB.NET...

This topic is 5688 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

Im using DX9 and VB.NET I do the following but it does not seem to pass the surface and rect into the other sub, the string works fine. If I change the ddsSurface & myRect withing the BMPLoad sub to ddsLogo & rLogo then it works fine. Anybody have any idea why this wouldnt work?, I used to do this the same way in Visual Basic 6 and it worked fine: public sub Main() BmpLoad(ddsLogo, rLogo, "C:\My Projects\Magic Dust - DX9\bin\Data\Logo.bmp") end sub Public Sub BmpLoad(ByVal ddsSurface As Surface, ByVal myRect As System.Drawing.Rectangle, ByVal nameFile As String, Optional ByVal TransCol As Integer = 0) Dim SDes As New SurfaceDescription() '' Describes a surface. Dim ck As New ColorKey() ddsSurface = Nothing Try ''Load sprite ddsSurface = New Surface(nameFile, SDes, DD) ddsLogo.SetColorKey(ColorKeyFlags.SourceDraw, ck) rLogo = New System.Drawing.Rectangle(0, 0, 800, 600) ''SDes.Width, SDes.Height) Catch Debug.WriteLine("Error loading:" + nameFile) End Try End Sub

Share this post


Link to post
Share on other sites
Advertisement
Hi-

I''m not all that familiar with vb.net, but have you tried passing the surface BYREF instead of BYVAL?

Hope this helps-

BM

Share this post


Link to post
Share on other sites
BYREF would be a thing indeed...

thats the same as LPDIRECTDRAWSURFACEx *lpDDSurface in C, right?
double pointer?

Share this post


Link to post
Share on other sites
Thanks, that worked.

.NET automatically sets them to ByVal if you dont specify which one to use. In Visual Basic 6 if you didnt specify it would set it to the correct one. So now I need to remember to specify each time

Share this post


Link to post
Share on other sites
Hi - yes - VB 6.0 assumes byref if you do not specify byval, and this apparently caused a lot of problems, so vb.net now assumes byval.

Good luck-

BM

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!