SelectedIndex
SelectedItem
SelectedText- this.comboBox1.Items.AddRange(new object[] {
- "男",
- "女",
- "未知"});
复制代码- 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)
- {
- comboBox1.SelectedItem = "未知";
-
-
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- try
- {
- textBox1.Text += "SelectedItem:" + comboBox1.SelectedItem + " 类型:" + comboBox1.SelectedItem.GetType() + "\r\n";
- textBox1.Text += "SelectedIndex:" + comboBox1.SelectedIndex.ToString() + " 类型:" + comboBox1.SelectedIndex.GetType() + "\r\n";
- textBox1.Text += "SelectedText:" + comboBox1.SelectedText + " 类型:" + comboBox1.SelectedText.GetType() + "\r\n";
- }
- catch (Exception ex)
- {
- throw (ex);
- }
- }
- }
- }
复制代码 SelectedValue 看这个
http://blog.csdn.net/downmoon/article/details/6159191 |