Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Heeelloo again...
I wanna send stringbuilder elements to other form. I tend to believe, that elements should be sent to listbox.
Here is the elements, i wanna send to form:

C#
public string DisplayText
{
    get
    {
        if (this.Count == 0)
            return string.Empty;
        else
        {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.AppendLine("Order of" + DateTime.Now.ToString());
            stringBuilder.AppendLine();
            stringBuilder.AppendLine("Customer: " + Username);
            stringBuilder.AppendLine("-------------------------------------------------------------------------------------------------------------------------------------");
            foreach (var orderDetailBLL in this)
            {
                stringBuilder.AppendLine(orderDetailBLL.DisplayText);
            }
            stringBuilder.AppendLine("-------------------------------------------------------------------------------------------------------------------------------------");
            stringBuilder.AppendLine("Total: " + this.Total.ToString() + " $");
            return stringBuilder.ToString();
        }
    }
}



How can i do that? I've created listbox in the destination form. What should i do and write next?

Regards ;)
Posted
Updated 4-Jun-10 11:38am
v2

Read the article below on passing values between forms:

Passing Values between Forms in .NET 1.x with C# and VB.NET examples[^]
 
Share this answer
 
Expose a property in one form and allow the other form to read this property.
That would be the simplest that you would need to do.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900