惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
G
Google Developers Blog
B
Blog
Engineering at Meta
Engineering at Meta
阮一峰的网络日志
阮一峰的网络日志
The Register - Security
The Register - Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 叶小钗
The Cloudflare Blog
The Hacker News
The Hacker News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
雷峰网
雷峰网
F
Fortinet All Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
A
About on SuperTechFans
量子位
Recorded Future
Recorded Future
博客园 - 三生石上(FineUI控件)
H
Help Net Security
Help Net Security
Help Net Security
P
Palo Alto Networks Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Troy Hunt's Blog
W
WeLiveSecurity
V
Vulnerabilities – Threatpost
T
The Exploit Database - CXSecurity.com
Know Your Adversary
Know Your Adversary
Apple Machine Learning Research
Apple Machine Learning Research
Scott Helme
Scott Helme
N
News | PayPal Newsroom
AWS News Blog
AWS News Blog
D
DataBreaches.Net
Blog — PlanetScale
Blog — PlanetScale
MongoDB | Blog
MongoDB | Blog
B
Blog RSS Feed
腾讯CDC
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
TaoSecurity Blog
TaoSecurity Blog
GbyAI
GbyAI
Y
Y Combinator Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
D
Docker

博客园 - lining

输出的客户端 - lining - 博客园 List<T> - lining - 博客园 DateTime 赋空值 配色达人速成 批处理文件,删除文件及文件夹 - lining - 博客园 Source Code中pfx的密码 查找所有有某一列的表 如何修改 app.config 的配置信息 用例的获得 如何oracle调试存储过程 C# 中String 和 string 有什么区别 ora-00997:非法使用LONG数据类型 oracle如何判断一个字符串是否为数字或日期 C# 中的计时器 populate a listbox on winform with values from database 查看oracle执行计划 “Windows Workflow Foundation开发实战系列课程”中的数据库恢复 ASP.NET多语言版的开发 oracle数据导入导出imp/exp命令
winform技巧,listbox绑定,value,text, - lining - 博客园
lining · 2010-06-18 · via 博客园 - lining

from->http://www.cnblogs.com/virusswb/articles/1206888.html

private void button1_Click(object sender, EventArgs e)
{
    List<Vector> list = new List<Vector>();
    list.Add(new Vector("swb1", 1));
    list.Add(new Vector("swb2", 2));
    list.Add(new Vector("swb3", 3));
    list.Add(new Vector("swb4", 4));
    list.Add(new Vector("swb5", 5));
    listBox1.DataSource = list;
    listBox1.DisplayMember = "Name";
    listBox1.ValueMember = "Id";
    this.textBox1.Text = "Id";
    this.textBox2.Text = "Name";
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    //this.textBox1.Text = listBox1.SelectedItem
    object obj = listBox1.Items[this.listBox1.SelectedIndex];
    this.textBox1.Text = ((Vector)obj).Name;
    this.textBox2.Text = listBox1.SelectedValue.ToString(); ;
}

class Vector
{
    private string _name;
    private int _id;

    public string Name
    {
        get { return this._name; }
        set { this._name = value; }
    }
    public int Id
    {

        get { return this._id; }
        set { this._id = value; }
    }
    public Vector()
    { }
    public Vector(string name, int id)
    {
        this._name = name;
        this._id = id;
    }
}