can someone tell me how to get the values of the dynamic texbox created..on my first code, i munaully put textboxes..but resulted to non efficient code according to my prof..so i found a code that dynamically create texboxes, but my problem now is how to get the values of them. now, i want to get the values so that i can ccalculate it by the non-preemptive priority scheduling rule..so hooooooww :(

Dim captions() As String = {"Burst Time for Job ", "Priority Number for job "}
        ' Coordinates for the controls.
        Dim y As Integer = 60
        inputjobnumber = Val(txtboxinputnojob.Text)

        For i As Integer = 1 To inputjobnumber

            For Each caption As String In captions

                ' Make the Label.
                Dim new_label As New Label()
                new_label.Parent = Me
                new_label.Text = caption + i.ToString
                new_label.Location = New Point(8, y)
                new_label.AutoSize = True


                ' Make the TextBox.
                Dim new_textbox As New TextBox()
                new_textbox.Parent = Me
                new_textbox.Location = New Point(130, y)
                new_textbox.Name = "txt" & i


                ' Move down.
                y += new_textbox.Height + 4


            Next caption
            y += 10
        Next
jayson.arizabal commented: non preemptive priority +0

Declare a variable with Class scope and save a reference to the textbox in that variable. The proper way to create the control is as follows:

mytextbox = New TextBox()
mytextbox.Location = New Point(130,y)
Me.Controls.Add(mytextbox)

Then to get the entered text just use

text = mytextbox.Text
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.