如何在树视图后面添加 ID?代码:
string players = "Name:Peter ID:1 Name:karl ID:2 Name:max ID:3 Name:Nils ID:4";
var user = players.split().Where(a => a.StartWith("Name:")).ToList();
var ID = players.split().Where(a => a.StartWith("ID:")).ToList();
for(int i= 0; i<user.Count(); i++) {
var pl = user[i].Substring(user[i].IndexOf(":") + 1);
var plid = ID[i].Substring(ID[i].IndexOf(":") + 1);
treeView1.Nodes.Add(pl);
}
现在,如果选择用户,我想在文本框中显示 ID
编辑:我试过了
treeView1.Tag = plid;
但这不起作用..
手掌心
相关分类