Click here to Skip to main content
Rate this: bad
good
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 21:23pm
Edited 29-May-11 21:33pm
v2
Comments
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?!
--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
0 OriginalGriff 390
1 Jochen Arndt 150
2 Richard MacCutchan 135
3 DamithSL 95
4 Garth J Lancaster 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,260


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