Skip to main content
gamedev.net
🔒 Locked

Problems with VB.NET...

Started by EdwardD Dec 23, 2002 at 2:00 PM 3 replies 450+ views
Original Post
EdwardD
EdwardD
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
bmoberly
bmoberly
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
Qatal
Qatal
BYREF would be a thing indeed...

thats the same as LPDIRECTDRAWSURFACEx *lpDDSurface in C, right?
double pointer?
die or be died...i think
EdwardD
EdwardD
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

bmoberly
bmoberly
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.