basically this generates boxes dynamically.  I have 7 pictureboxes
loading random letters.  I was wondering how I can type a certain word
row column and direction and move the word typed into the boxes that
were generated.



Dim buttonnum As Integer
        Dim mybutton As New PictureBox
        Dim i As Integer
        Dim j As Integer
        Dim r As New Random
        Dim s As String
        Dim n As Integer

        n = r.Next(0, 26)
        s = "Tile"
        If n <= 9 Then s += "0"
        s += n.ToString
        pictray1.Image = My.Resources.ResourceManager.GetObject(s)

        n = r.Next(0, 26)
        s = "Tile"
        If n <= 9 Then s += "0"
        s += n.ToString
        pictray2.Image = My.Resources.ResourceManager.GetObject(s)

        n = r.Next(0, 26)
        s = "Tile"
        If n <= 9 Then s += "0"
        s += n.ToString
        pictray3.Image = My.Resources.ResourceManager.GetObject(s)


        n = r.Next(0, 26)
        s = "Tile"
        If n <= 9 Then s += "0"
        s += n.ToString
        pictray4.Image = My.Resources.ResourceManager.GetObject(s)


        n = r.Next(0, 26)
        s = "Tile"
        If n <= 9 Then s += "0"
        s += n.ToString
        pictray5.Image = My.Resources.ResourceManager.GetObject(s)


        n = r.Next(0, 26)
        s = "Tile"
        If n <= 9 Then s += "0"
        s += n.ToString
        pictray6.Image = My.Resources.ResourceManager.GetObject(s)


        n = r.Next(0, 26)
        s = "Tile"
        If n <= 9 Then s += "0"
        s += n.ToString
        pictray7.Image = My.Resources.ResourceManager.GetObject(s)



        'pictray1.Image = My.Resources.Tile02
        'pictray1.Image = My.Resources.ResourceManager.GetObject(s)
        'pictray2.Image = My.Resources.Tile03
        'pictray2.Image = My.Resources.ResourceManager.GetObject(s)
        'pictray3.Image = My.Resources.Tile06
        'pictray3.Image = My.Resources.ResourceManager.GetObject(s)
        'pictray4.Image = My.Resources.Tile08
        'pictray4.Image = My.Resources.ResourceManager.GetObject(s)
        'pictray5.Image = My.Resources.Tile09
        'pictray5.Image = My.Resources.ResourceManager.GetObject(s)
        'pictray6.Image = My.Resources.Tile01
        'pictray6.Image = My.Resources.ResourceManager.GetObject(s)
        'pictray7.Image = My.Resources.Tile05
        'pictray7.Image = My.Resources.ResourceManager.GetObject(s)

        For i = 1 To 15
            For j = 1 To 15
                buttonnum = (j - 1) * 15 + i
                mybutton = New System.Windows.Forms.PictureBox
                mybutton.Location = New System.Drawing.Point(i * 30, j
* 30)
                mybutton.Name = "Button" & buttonnum

                mybutton.Size = New System.Drawing.Size(30, 30)
                mybutton.SizeMode = PictureBoxSizeMode.StretchImage
                mybutton.Text = buttonnum
                'mybutton.BackColor = Color.White
                Select Case buttonnum
                    Case 1, 8, 15, 106, 120, 211, 218, 225
                        'mybutton.Image = Image.FromFile("tile00.jpg")

                        mybutton.Image = My.Resources.TripleWord
                        'mybutton.BackColor = Color.red
                    Case 4, 12, 37, 39, 46, 53, 60, 93, 97, 99, 103,
109, 117, 123, 127, 129, 133, 166, 173, 180, 187, 189
                        mybutton.Image = My.Resources.DoubleLetter
                        'mybutton.BackColor = Color.LightBlue
                    Case 21, 25, 77, 81, 85, 89, 137, 141, 145, 149,
201, 205
                        mybutton.Image = My.Resources.TripleLetter
                        'mybutton.BackColor = Color.Blue
                    Case 17, 29, 33, 43, 49, 57, 65, 71, 155, 161,
169, 177, 183, 193, 197, 209
                        mybutton.Image = My.Resources.DoubleWord
                        'mybutton.BackColor = Color.Pink
                    Case Else
                        mybutton.BackColor = Color.White


                End Select
                Me.Controls.Add(mybutton)

            Next
        Next

Reply via email to