C#——列表框(listbox)的体验添加

来源:互联网 发布:嵌入式软件版本说明 编辑:程序博客网 时间:2024/06/06 19:20
/*烟台大学计算机学院学生       *All right reserved.       *文件名称:C#——列表框(listbox)的体验添加 *作者:杨飞       *完成日期:2014年9月2日       *版本号:v1.0       *对任务及求解方法的描述部分:C#——列表框(listbox)的体验添加*我的程序:*/using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication1{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        private void Form1_Load(object sender, EventArgs e)        {                        listBox1.Items.Add("语文");            listBox1.Items.Add("数学");            listBox1.Items.Add("外语");            listBox1.Items.Add("地理");            listBox1.Items.Add("体育");            listBox1.SelectedIndex = 0;        }        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)        {            label1.Text = listBox1.Text;        }        private void label1_Click(object sender, EventArgs e)        {        }           }}

运行结果:

心得体会:呵呵

1 0
原创粉丝点击