Hi,
I’m at last coding in VB.net with the .net Microframework thanks to the hard work of the people at GHI converting libraries over to use .netmf 4.2
There are a couple of gotcha’s I’ve come across so far converting my Tyrannt game over to VB.
Firstly there is a small problem with the Auto-generated code for resouces which I expect will be fixed by the time the release comes out of Beta.
Inside the code-behind Resources.Designer.vb
Namespace TyranntVB
Partial Friend Class Resources
Private Shared manager As System.Resources.ResourceManager
Friend Shared ReadOnly Property ResourceManager() As System.Resources.ResourceManager
Get
If (Resources.manager Is Nothing) Then
Resources.manager = New System.Resources.ResourceManager("TyranntVB.Resources", GetType(Resources).Assembly)
End If
Return Resources.manager
End Get
End Property
You’ll notice there is a Namespace being used. This is what is required in C# but not in Visual Basic. If you remove the Namespace commands
Partial Friend Class Resources
Private Shared manager As System.Resources.ResourceManager
Friend Shared ReadOnly Property ResourceManager() As System.Resources.ResourceManager
Get
If (Resources.manager Is Nothing) Then
Resources.manager = New System.Resources.ResourceManager("TyranntVB.Resources", GetType(Resources).Assembly)
End If
Return Resources.manager
End Get
End Property
Code like this
Resources.GetFont(Resources.FontResources.tyrannt)
Will compile successfully.
Secondly, by default, the project will not know about constants like vbCr and vbLf. I used “\n” quite a bit inside the C# code and when I came to use vbLf the equivalent in VB.net, it caused a compilation error. This is simple to fix. Add the following Imports statement to the top of your code and away you go.
Imports Microsoft.VisualBasic.Constants
I’ll hopefully post again when I have the code ported and running on the Spider.