Click here to Skip to main content
13,087,566 members (93,500 online)
Rate this:
Please Sign up or sign in to vote.
See more:

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

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


I want O/p make a table ,row,column hen value
Posted 29-May-11 20:23pm
Updated 29-May-11 20:33pm
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?!
Rate this: bad
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.

Rate this: bad
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.

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 |
Web03 | 2.8.170813.1 | Last Updated 30 May 2011
Copyright © CodeProject, 1999-2017
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