Results 1 to 2 of 2

Thread: [RESOLVED] Check Box Array....help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    180

    Resolved [RESOLVED] Check Box Array....help

    I know that VB.NET no longer supports arraying of controls, how-ever I found a few threads here on the forum pertaining to ways around this. I tried a few of them, and I cant seem to get it to work correctly. It seems to work, however I cant seem to make them visible. Anyone know what I'm doing wrong?


    Code:
    Public Class Form1
        Private chekbox(10) As CheckBox
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub
    
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            For i = 1 To 10
                chekbox(i) = New CheckBox()
                chekbox(i).Visible = True
                chekbox(i).Left = i
                chekbox(i).Top = i
            Next
        End Sub
    End Class
    This should show the boxes, just super-imposed on one another. However it doesnt. Any clue?

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: Check Box Array....help

    vb Code:
    1. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2.Click
    2.      For i As Integer = 1 To 10
    3.           chekbox(i) = New CheckBox()
    4.           Me.Controls.Add(chekbox(i))
    5.           chekbox(i).Visible = True
    6.           chekbox(i).Left = i
    7.           chekbox(i).Top = i
    8.      Next
    9. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width