2 Replies - 656 Views - Last Post: 17 October 2010 - 08:29 PM Rate Topic: -----

#1 shain mcvay  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 26-June 08

Trying to make and place pictureboxes on the screen with an array

Posted 17 October 2010 - 07:34 PM

I'm trying to figure out how to plac units and their men on the form but I cant seem to get this array to work. It has muliple errors in it. Anyone know how to get it to work?

        Dim pic(calctroops()) As New PictureBox
        Dim z As Integer = 15
        For i = 0 To Form3.orcunits
            For x = 1 To Form3.orc(orcunits)
                z = z + 15
                pic(i).Location = New Point(Orc1.x + z, Orc1.y)
                pic(i).BackColor = Color.Green
                Me.Controls.Add(pic(i))
            Next x
        Next i 


Is This A Good Question/Topic? 0
  • +

Replies To: Trying to make and place pictureboxes on the screen with an array

#2 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1162
  • View blog
  • Posts: 4,444
  • Joined: 02-July 08

Re: Trying to make and place pictureboxes on the screen with an array

Posted 17 October 2010 - 07:56 PM

We need to know more of the underlying structures. If you opened form3 as the default instance then you can access it's members otherwise orc(orcunits) will be empty/nothing.
Was This Post Helpful? 0
  • +
  • -

#3 shain mcvay  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 26-June 08

Re: Trying to make and place pictureboxes on the screen with an array

Posted 17 October 2010 - 08:29 PM

This is the code in form3

Public orc(3) As Integer
     Public orcunits As Integer


    Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Static x, y, points As Integer

        orcunits = orcunits + 1
        points = 5
        orc(orcunits) = TextBox1.Text
        y = points * orc(orcunits)
        ListBox1.Items.Add("Orc" & x + 1 & "                  " & orc(orcunits) & "                     " & points * orc(orcunits))
        totalpointssub(y)

    End Sub

This post has been edited by shain mcvay: 17 October 2010 - 08:30 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1