C#ComboBox控件用法小节

翻译|其它|编辑:郝浩|2007-09-25 10:38:10.000|阅读 3499 次

概述:

# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

 

namespace ComboBox

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void Form1_Load(object sender, EventArgs e)

        {

            string[] array =

      

         { "软体学院","经济管理学院","外语学院","公共管理学院","体育学院","化学学院","计算技术学院","人文科技学院","法学学院","文化传播学院","物电科学技术学院"};

            comboBox1.DataSource = array;

        }

 

        private void comboBox1_SelectedValueChanged(object sender, EventArgs e)

        {

            label1.Text = "你选择的是:   " + comboBox1.SelectedIndex.ToString();

            label2.Text = "你选择的是:   " + comboBox1.SelectedItem.ToString();

        }

    }

}


标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com

文章转载自:csdn

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP