Skip to content

VB.Net Control Array

January 24, 2012

    Private Sub ControlArray()
        Using dt As DataTable = Test.GetPartsData
            ReDim txtRuns(dt.Rows.Count - 1)
            txtRuns(i) = New TextBox
            txtRuns(i).Text = dt.Rows(i)("Runs")
            txtRuns(i).Tag = i
            txtRuns(i).Visible = True
            txtRuns(i).Enabled = False
            txtRuns(i).ReadOnly = True
            txtRuns(i).Width = 30
            txtRuns(i).TextAlign = HorizontalAlignment.Center
            If i = 0 Then
                txtRuns(i).Top = 3
                txtRuns(i).Left = 135
            Else
                txtRuns(i).Top = txtRuns(i - 1).Top + txtRuns(0).Height + 5
                txtRuns(i).Left = txtRuns(i - 1).Left
            End If
            pnlParts.Controls.Add(txtRuns(i))
        End Using
    End Sub
    '
Advertisements

From → .Net

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: