首页 > 代码库 > winfrom 下 listbox 选项添加value

winfrom 下 listbox 选项添加value

public struct MyItem
{
public string Name;
public string Tag;
public override string ToString()
{
return Name;
}
}

MyItem item;
item.Name= "张三 ";
item.Tag= "aaa ";

//添加
ListBox1.Items.add((Object)item);

//....

//取出
MyItem theItem=(MyItem)ListBox1.SelectedItem;

if (theItem.Tag== "aaa ")
{
//....
}

winfrom 下 listbox 选项添加value