Click here to Skip to main content
12,405,700 members (73,698 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: string Builder
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 29-May-11 20:23pm
Updated 29-May-11 20:33pm
v2
Comments
walterhevedeich 30-May-11 2:25am
   
like what?
SAKryukov 30-May-11 2:31am
   
Always tag it. It has something to do with UI, so, is it WPF, Forms, APS.NET, what?!
--SA
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 30 May 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100