界面编程C# ListBox的基本操作

开发 后端
下面是C#界面编程的ListBox和ComboBox控件介绍,其中大部分是围绕是C# ListBox介绍的,很基本,很实际的操作。

下面是C#界面编程的ListBox和ComboBox控件介绍,主要是关于关于C# ListBox的介绍。

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.ComponentModel;  
  4. using System.Data;  
  5. using System.Drawing;  
  6. using System.Text;  
  7. using System.Windows.Forms;  
  8. namespace ListAndCombo  
  9. {  
  10.     public partial class ListAndCombo : Form  
  11.     {  
  12.         public ListAndCombo()  
  13.         {  
  14.             InitializeComponent();  
  15.         }  
  16.         private void Form1_Load(object sender, EventArgs e)  
  17.         {  
  18.             //初始化设置  
  19.             //ListBox 设置  
  20.             listBox1.Items.Add("1000 以下");  
  21.             listBox1.Items.Add("1001~2000");  
  22.             listBox1.Items.Add("2001~3000");  
  23.             listBox1.Items.Add("3001~4000");  
  24.             listBox1.Items.Add("4001~6000");  
  25.             listBox1.Items.Add("6001~8000");  
  26.             listBox1.Items.Add("8001~10000");  
  27.             listBox1.Items.Add("10000 以上");  
  28.             //ComboBox 设置  
  29.             comboBox1.Items.Add("身份证");  
  30.             comboBox1.Items.Add("学生证");  
  31.             comboBox1.Items.Add("教师证");  
  32.             comboBox1.Items.Add("军人证");  
  33.             comboBox1.Items.Add("护照");  
  34.         }  
  35.         private void listBox1_SelectedIndexChanged(object sender, EventArgs e)  
  36.         {  
  37.             label3.Text = listBox1.SelectedItem.ToString();  
  38.         }  
  39.         private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)  
  40.         {  
  41.             label4.Text = comboBox1.SelectedItem.ToString();  
  42.         }  
  43.     }  
  44. }  
  45.  

以上就是对编程界面实现的C# ListBox的简单介绍。

【编辑推荐】

  1. C#委托基础:谈委托和接口
  2. 简单实现C# CheckBox单选的相关功能
  3. C# ServiceController类剖析
  4. C# HttpWebRequest提交数据方式浅析
  5. C#计算素数序列浅谈
责任编辑:阡陌 来源: 网络转载
相关推荐

2009-09-08 15:39:00

2009-09-08 17:37:54

C# listbox控

2009-08-12 15:50:40

C# ListBox

2009-08-19 11:21:02

C# ListBox控

2009-08-14 14:19:50

Enhanced LiC#构建

2009-09-08 14:54:40

C# listBox控

2009-09-08 16:22:27

c# listBox

2009-09-08 16:34:49

C# Listbox

2009-09-10 12:00:09

C# listbox

2009-09-08 15:12:07

C# ListBox

2009-09-02 18:11:24

C#鼠标

2009-09-08 16:01:58

C# ListBox

2009-08-21 14:47:39

C#网络编程

2009-09-08 15:50:44

c# listbox

2009-08-19 15:38:59

C#代码

2009-09-08 14:43:41

C# listbox

2009-08-11 15:44:05

C#基本技巧

2009-09-09 18:20:29

C# XML编程

2009-08-24 09:55:26

C#接口转换

2009-08-26 10:34:15

C#类型C#变量
点赞
收藏

51CTO技术栈公众号