您的位置 首页 java

C井之WinForm基础 comboBox1.SelectedIndex控件选中数据项索引值

慈心积善融学习,技术愿为有情学。善心速造多好事,前人栽树后乘凉。我今于此写经验,愿见文者得启发。

1、UI

C井之WinForm基础 comboBox1.SelectedIndex控件选中数据项索引值

2、代码

form1. cs

  1. using System;
  2. using System.Collections. Generic ;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace WindowsFormsApplication2
  11. {
  12. public partial class Form1 : Form
  13. {
  14. public Form1()
  15. {
  16. InitializeComponent();
  17. }
  18. private void button1_Click(object sender, EventArgs e)
  19. {
  20. MessageBox .Show(comboBox1.SelectedIndex. ToString ());
  21. }
  22. }
  23. }

3、效果图

C井之WinForm基础 comboBox1.SelectedIndex控件选中数据项索引值


感恩曾经帮助过 心少朴 的人。

C#优秀,值得学习。Winform, WPF 都可以关注一下,眼界要开阔。

Visual Studio IDE很好用,推荐!

注:此文是自学笔记所生,质量中等,故要三思而后行。新手到此,不可照搬,应先研究其理象数,待能变通之时,自然跳出深坑。


文章来源:智云一二三科技

文章标题:C井之WinForm基础 comboBox1.SelectedIndex控件选中数据项索引值

文章地址:https://www.zhihuclub.com/169821.shtml

关于作者: 智云科技

热门文章

网站地图