| | |
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 |
Tag cloud for C#
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# chat check checkbox class client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms function gdi+ httpwebrequest image index input install java label list listbox listener login mandelbrot math mouseclick mysql networking object operator oracle path photoshop picturebox pixelinversion post prime programming radians regex remote remoting resource saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml





