Solved

Arraylist to textbox in web form

Posted on 2007-11-17
3
753 Views
Last Modified: 2012-05-05
I am trying to figure out how to copy an arraylist to a textbox in a web form... I figured out how to do it with a windows form using textbox.AppendText in a foreach, but I cannot use AppendText in the web form...  thanks for the help!
0
Comment
Question by:brassmon
  • 2
3 Comments
 
LVL 29

Accepted Solution

by:
Göran Andersson earned 500 total points
ID: 20306616
Use a StringBuilder to create the string:
StringBuilder builder = new StringBuilder();
foreach (object o in theArrayList) {
   builder.AppendLine(o.ToString());
}
theTextBox.Text = builder.ToString();

Open in new window

0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20306620
something like this:

StringBuilder sb = new StringBuilder();
foreach (object o in yourList)
{
      sb.Append(o);
      sb.Append(" ");
}
textbox.Text = sb.ToString();
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20306624
Sorry, not refreshed...
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question