我想在 windows 窗体 c# 中创建表。我得到这个词,拆分它,我想将它的字符数组设置为表的标题。当我添加新词时,我想拆分它,将它设置在标题下的新行中,并将每个字符与标题的相同列进行比较。我不知道在表格中输入的字数和字数,我该如何创建它?例子:
word for header: book --> split it and set in header
new word : bird --> split it and set in new row
table:
b o o k
b i r d
另一个问题:如果我的窗体被关闭并再次打开,我想再次给出这些话,我不想失去主题。感谢您的帮助...
更新:
private void wordbtn_Click(object sender, EventArgs e)
{
char[] list = wordBox.Text.Replace(" ", "").ToCharArray();
var repeatedChars = wordBox.Text.Replace(" ", "").ToCharArray().GroupBy(x => x)
.Where(y => y.Count() > 1).Select(g => new { Letter = g.First(), Count = g.Count() });
int repeatCount = repeatedChars.Count();
int listCount = list.Count();
int cell = repeatCount + listCount + 2;
List<char[]> ll = new List<char[]>();
ll.Add(list);
// DataTable dt = new DataTable();
//i want to create table for words by characters
}
但是当我发送新单词时,列表中只有它,其他单词被清除。