Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi..

In my textbox.text,want to display a Table structure with rows and columns and Iam making this table in string Builder.But not able to achieve this.It's displaying static tags Like this like this.Plz help

sr = string Builder
sr.AppendLine("
");
sr.AppendLine("
");
sr.AppendLine("Rajni
");

txtname.Text = sr.ToString();
O/p is


Rajni


I want O/p make a table ,row,column hen value
Posted
Updated 29-May-11 20:33pm
v2
Comments
walterhevedeich 30-May-11 2:25am    
like what?
Sergey Alexandrovich Kryukov 30-May-11 2:31am    
Always tag it. It has something to do with UI, so, is it WPF, Forms, APS.NET, what?!
--SA

Bad idea. TextBox displays just the plain text. If you want to show columns, it's nearly impossible to align them. If you use blank space characters it will work only with monospace font. If you use Tab character, you never know if some cell element in some column is longer than the tab length which can shift text into a different columns for a different links.

Use Grid View of List View controls instead.

StringBuilder is completely irrelevant to the topic.

—SA
 
Share this answer
 
A textbox is a bad choice of output control at the best of times: users expect to be able to enter data into them.
To try to use one for tabulated data is just silly: A text box can only just cope with lines, and does not have formatting instructions: just text.

Instead, look at your data and your application: use a ListView, DataGrid, or DateGridView instead, possibly a TreeView depending on your data and what kind of application you are running.
 
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