| | |
Accessing data from Dynamically created textboxes
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2007
Posts: 10
Reputation:
Solved Threads: 0
I have a project where the user has to input a range of questions along with the question numbers. (So the number of questions is not fixed.) I am using a panel where i am adding the dynamically created textboxes. The textboxes are created with the user clicks an image button.
So far so good.
now i want to store the questions entered by the user in a databaase, how can i achieve this?
Also if the user creates and enters the data in the textbox, and later when he returns, i wld like to show the data previuosly entered by him, how can i achive this?
Thank in advance
So far so good.
now i want to store the questions entered by the user in a databaase, how can i achieve this?
Also if the user creates and enters the data in the textbox, and later when he returns, i wld like to show the data previuosly entered by him, how can i achive this?
Thank in advance
•
•
Join Date: Jun 2008
Posts: 58
Reputation:
Solved Threads: 9
set the Name property of the textboxes to a common name and increment with numbers, for example, "txtQuestion1", "txtQuestion2", etc.
Then later you can iterate through the Controls collection (through the Form or whatever is holding the textboxes) and if the name starts with "txtQuestion" for example, take it's Text value and store it.
To load the values just do the process backwards, setting the Text property to "txtQuestion" boxes (or as you create them).
Hope that helps a bit
Then later you can iterate through the Controls collection (through the Form or whatever is holding the textboxes) and if the name starts with "txtQuestion" for example, take it's Text value and store it.
To load the values just do the process backwards, setting the Text property to "txtQuestion" boxes (or as you create them).
Hope that helps a bit
Visual C# Kicks - Free C# code resources and articles.
![]() |
Other Threads in the C# Forum
- Previous Thread: Getting cursor position from grid view
- Next Thread: Ten Thousand Animations, Curses!
| Thread Tools | Search this Thread |
.net access algorithm alignment app array barchart bitmap box broadcast buttons c# c#gridviewcolumn check checkbox client combobox communication control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing elevated encryption enum event excel file focus form format forms function gdi+ hospitalmanagementsystem httpwebrequest image index input install java label list listbox localization login mandelbrot math messagebox mouseclick mysql operator path photoshop picturebox pixelinversion plotting pointer post programming radians read regex remote remoting richtextbox server sleep socket sql statistics stream string stringformatting sun table text textbox thread time timer update usercontrol validation visualstudio webbrowser whileloop windows winforms wpf xml





