Results 1 to 1 of 1

Thread: [RESOLVED] handle controls created at runtime from a module?

Threaded View

  1. #1

    Thread Starter
    Junior Member iRoN_RoCK's Avatar
    Join Date
    Jul 2008
    Posts
    31

    Resolved [RESOLVED] handle controls created at runtime from a module?

    This is how I create textboxes at runtime:
    Code:
        Public TextBox1 As TextBox() = New TextBox(26) {}
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim CNT As Integer = 0
            Dim Y As Integer = 8
            Dim Y2 As Integer = 8
            While CNT < 26
                TextBox1(CNT) = New TextBox
                TextBox1(CNT).Size = New System.Drawing.Size(40, 20)
                TextBox1(CNT).Text = vbNullString
                TextBox1(CNT).MaxLength = 2
    
                If CNT >= 18 Then
                    TextBox1(CNT).Location = New System.Drawing.Point(295, Y2)
                    Y2 = Y2 + 20
                Else
                    TextBox1(CNT).Location = New System.Drawing.Point(130, Y)
                    Y = Y + 20
                End If
    
                Me.Controls.AddRange(New System.Windows.Forms.Control() {TextBox1(CNT)})
                CNT += 1
            End While
        End Sub
    I can handle these textboxes from my form class but how can I handle them from a module?

    EDIT: Sorry, I can already handle them, forgot to use "Form1.Textbox1" instead of just "Textbox1". I must be working hard...
    Last edited by iRoN_RoCK; Apr 15th, 2009 at 12:31 AM.

Tags for this Thread

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