Here is a look at what I have so far
Public Class Tiles Shared Function newWorld(ByVal WIDTH As Integer, ByVal HEIGHT As Integer) Dim n As Integer = 0 Dim COL As Integer = 0 Dim ROW As Integer = 0 Try Dim j As Integer = 0 For i As Integer = 0 To (WIDTH * HEIGHT) Dim TILE() As Object TILE(n) = New PictureBox TILE(n).Name = "TILE" + n.ToString TILE(n).Width = 32 TILE(n).Height = 32 TILE(n).ImageLocation = "./images/tiles/dirt.png" TILE(n).Location = New Point(COL * 32, ROW * 32) j = j + 1 ROW = ROW + 1 n = n + 1 If (j = WIDTH) Then ROW = 0 COL = COL + 1 End If Next Return 0 Catch ex As Exception Main.Label1.Text = ex.ToString Return ex End Try End Function End Class
This function is called in
Public Class Main Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Tiles.newWorld(32, 32) End Sub End Class
At present it doesn't do anything an just returns a null pointer exception. (That's displayed in Label1 on the Main form).