最近看了Winform在DataGrid中怎么嵌入Combo,想到平时项目中写到的一些临时小工具,经常用配置参数,有些配置是简单的地址或文本,有些则是类似1代表SQL,2代表Oracle等。于是想结合刚刚学的知识,做一个示例。

  关于参数的保存,想到用数据库,简单点就是用SQLite,可以无需安装数据库,后来想想,干脆用文件进行存储,这样简单,而且.net对Json的支持很好。

资源下载

  示例代码

  Winform 在DataGrid中签入Combo

  Winform 在DataGrid中签入Combo

实现

  1.设计数据结构。

    public class ListItem
    {
        public List<ListItem> lstItem = new List<ListItem>();
        public string Text { get; set; }
        public object Value { get; set; }

        public ListItem() { }
        public ListItem(string pText, string pValue) { Text = pText; Value = pValue; }

        public override string ToString()
        {
            return Text;
        }
    }
Combo Item数据结构

相关文章:

  • 2021-10-03
  • 2022-12-23
  • 2022-02-27
  • 2022-12-23
  • 2021-10-14
  • 2021-06-06
猜你喜欢
  • 2021-06-17
  • 2022-12-23
  • 2022-03-03
  • 2021-10-01
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
相关资源
相似解决方案