Click here to Skip to main content
11,798,866 members (41,986 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: string Builder

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
Edited 29-May-11 20:33pm
walterhevedeich at 30-May-11 2:25am
like what?
SAKryukov at 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
0 CPallini 465
1 OriginalGriff 378
2 Maciej Los 305
3 Richard MacCutchan 281
4 phil.o 244
0 OriginalGriff 2,270
1 Maciej Los 1,810
2 KrunalRohit 1,496
3 CPallini 1,425
4 Richard MacCutchan 1,109

Advertise | Privacy | Mobile
Web03 | 2.8.151002.1 | Last Updated 30 May 2011
Copyright © CodeProject, 1999-2015
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