I'll be going on a trip for the next 8 days with my mom and grandma. Leaving tomorrow. Will be back the evening of the 21st.

See everyone soon!

Member Avatar


Have a good time!

enjoy, have a great family time.

Have a nice time!

Thanks! Keep an eye on things while I'm gone.

Family time is always time well spent. Enjoy!!!

PS. Say hello to your mum from me.

Perhaps share a microwaved bagel with g'ma?

hehe :)

commented: If you ever meet my wife you can tell her that (at least occasionally) I DO pay attention. +0
Member Avatar


Have a nice time. :)

Hey Reverend Jim,
Hope you and your family are having a good time. I have a question about some code you posted about 3 yrs back. For the most part it is doing what I need but I cannot figure out an added feature that I want to give it. If you would give me a shout back...Greg

Member Avatar


Ha ha ha. That was defintely the right place to post that. Dani.s vacation. Your fan club is getting out of hand RJ!

commented: It's a very small club ^_^ +0

@Greg - you'll have to narrow it down a bit. What code are you referring to?

Reverend Jim,
I found the code you posted pertaining to creating textboxes dynamically on a form using VB.net. Once the program is executed I have it place 246 textboxes on the form. After they are created I then read a text file and load each box with the text in the file. All of this works fine. I also have the .tag property to increment by 1 think I would use it to step throught the boxes when I save the form. I placed a "save" button on the form so if I make any changes I can save it back to the file or another file of my choosing. When I click on the button it saves the last line 245 times. How do I step through all of the textboxes so I can write the text of each box to the text file? When loading the form I have set the .tag property to increment by 1 think I would use it to step through the boxes when I save the form. I just cannot figure out how to use the .tag property to allow me to step through the textboxes to save each line of text. In the example I have the basic code only.

 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim FILE_NAME As String = "C:\Test.txt"

        If File.Exists(FILE_NAME) = True Then

            Dim objWriter As New StreamWriter(FILE_NAME)

            For z As Integer = 1 To 245

                objWriter.Write(newbox.Text & vbCrLf, False)

                MessageBox.Show("Text written to file")

                MessageBox.Show("File Does Not Exist")

        End If
    End Sub

Here is the snipet that creates the textboxes on the form. This works perfectly when it is included in my project.

  For i As Integer = 1 To 245 ' 5 indecates the number of textbox you want to create.

            'create a new textbox and set its properties
            newbox = New TextBox
            newbox.Tag = i
            newbox.Size = New Drawing.Size(725, 20)
            newbox.Location = New Point(10, 20 + 23 * (i - 1))
            newbox.Text = sInputLine
            sInputLine = srFileReader.ReadLine()
            newbox.Name = "TextBox" & i
            'connect it to a handler, save a reference to the array and add it to the form controls
            AddHandler newbox.TextChanged, AddressOf TextBox_TextChanged_1
            boxes(i) = newbox


I finally found the solution to my problem. It was much more simple than I was expecting. Here's what I used.

 For z As Integer = 1 To 245

                objWriter.Write(Me.Controls("Textbox" & (z)).Text & vbCrLf, False)


I guess I had a serious brain fart on this one.

Best Regards,

Member Avatar


Get a room you two!