943,975 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 2003
  • C# RSS
Aug 6th, 2008
0

Accessing data from Dynamically created textboxes

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
C#Novice is offline Offline
11 posts
since Aug 2007
Aug 7th, 2008
0

Re: Accessing data from Dynamically created textboxes

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
Reputation Points: 11
Solved Threads: 9
Junior Poster in Training
vckicks is offline Offline
58 posts
since Jun 2008
Aug 9th, 2008
0

Re: Accessing data from Dynamically created textboxes

Hi, Also try DataGridView Control to add the Questions and Answer.
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Getting cursor position from grid view
Next Thread in C# Forum Timeline: Ten Thousand Animations, Curses!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC