LZ是这个意思吗?另外设置comboBox的DropDownStyle属性为DropDownList后,用户就不可以输入
设定comboBox1.SelectedIndex=0,默认显示第一项- 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 test4
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- comboBox1.Items.Add("Tom");
- comboBox1.Items.Add("Jim");
- comboBox1.Items.Add("Jerry");
- comboBox1.Items.Add("Lily");
- comboBox1.SelectedIndex = 0;
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- }
- }
- }
复制代码 |
|