使用String Builder在Textbox文本中操作表结构 [英] O/p the table structure in Textbox text using String Builder

查看:113
本文介绍了使用String Builder在Textbox文本中操作表结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..

在我的textbox.text中,想要显示一个具有行和列的Table结构,并且Iam在字符串生成器中创建此表.但是无法实现.它显示了像这样的静态标签.Plzhelp

sr =字符串生成器
sr.AppendLine("

");
sr.AppendLine("
");
sr.AppendLine("Rajni
");

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


Rajni


我想让O/p制作一张表格,行,列,母鸡值

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

推荐答案

坏主意. TextBox仅显示纯文本.如果要显示列,几乎不可能对齐它们.如果使用空格字符,则仅适用于等宽字体.如果使用制表符,则永远不会知道某个列中的某些单元格元素的长度是否大于制表符的长度,该长度可以将文本移动到用于不同链接的不同列中.

请改用列表视图"控件的网格视图".

StringBuilder与该主题完全无关.

—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


文本框在最佳情况下是错误的输出控制选择:用户希望能够在其中输入数据.
试图将其用于列表数据只是愚蠢的:一个文本框只能处理行,而没有格式说明:仅文本.

而是查看您的数据和应用程序:改用ListView,DataGrid或DateGridView,根据您的数据和所运行的应用程序的类型,可能使用TreeView.
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.


这篇关于使用String Builder在Textbox文本中操作表结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆