zoukankan      html  css  js  c++  java
  • 手动添加winform的combobox和listbox名称和值

    先定义一个ListItem类,工程内其他窗体都可以用的。 
    public class ListItem : Object
        {
            public string Text { get; set; }
            public string Value { get; set; }
            public ListItem(string text, string value)
            {
                this.Text = text;
                this.Value = value;
            }
            public override string ToString()
            {
                return this.Text;
            }
        }
    =========================================================
    使用时:
    ListItem li=new ListItem("名称","键值");
    之后就可以把li添加到combobox和listbox控件
    combobox1.items.add(li);
    微软越来越来懒了,像这种常用的东西都不提供了,还要自己写。哎
  • 相关阅读:
    1.8 Hello World添加menu
    1.7 HelloWorld 添加视图
    1.6 Hello World
    1.5 组件开发基础
    awk
    sed
    grep / egrep
    Shell基础知识
    和管道符有关的命令
    Shell变量
  • 原文地址:https://www.cnblogs.com/weipt/p/7569932.html
Copyright © 2011-2022 走看看