Hello,

I am working on desktop application. I had created number of dynamic textbox and label and I want to save that data on clicking the save button.

If any question, if you did not get my point clear than please ask. Its urgent. Please Help!!!
Please give me suggestion and help me to work on these.
It would be pleased and appreciated to any help

Thanks in advance..

What data are you trying to save and do you have a particular form you want to use (text file, per user settings etc). Are you trying to save the controls themselves for later use or just the data in those controls? If just the data, what do you want to do with that data? Will it be reloaded when the app is rerun?

Edited 4 Years Ago by Reverend Jim

Hi,
One method of getting the data from a dynamically created textbox is using a code simular to this.

  dim retrievedtext() as string 
  dim NofTB as integer
  For Each c In Controls
                Dim ControlType As Type = c.[GetType]()
                Dim case1 As String = ControlType.Name
            If case1 = "TextBox" Then
            NofTB += 1
            retrievedtext(NofTB) = c.text
            End If
        Next

The data from all the textboxes will be in the array retrieved and accessable for saving. This code iterates through all the controls on your form to find the textboxes then put the data for that textbox into the array. Since I don't know the names of your textboxes I would not be able to give you a better example but you retrieve data from any textbox either created dynamically or through the use of tools during design by using the textbox name and .text.

Curtis

This article has been dead for over six months. Start a new discussion instead.