• 加载ComboBox控件


           /// <summary>
            /// 加载公司
            /// </summary>
            /// <param name="cbbCompany">Combobox</param>
            public static void LoadValues2Company(System.Windows.Forms.ComboBox cbbCompany)
            {
                cbbCompany.DataSource = null;
                Company oComp = new Company();
    
                cbbCompany.DisplayMember = "NAME_CHS";
                cbbCompany.ValueMember = "ID";
    
                DataTable _dt = oComp.GetValidCompany();
                cbbCompany.DataSource = BaseClass.LoadInvalidValueToCombobox(_dt, "ID", "NAME_CHS");
        /// <summary>
            /// 加载一个无意义的值到Combobox控件
            /// </summary>
            /// <param name="dtSource">Combobox控件数据源</param>
            /// <param name="sValue">ValueMember字段</param>
            /// <param name="sDisplay">DisplayMember字段</param>
            /// <returns></returns>
            public static DataTable LoadInvalidValueToCombobox(DataTable dtSource, String sValue, String sDisplay)
            {
                DataRow _drNew = dtSource.NewRow();
                _drNew[sValue] = 0;
                _drNew[sDisplay] = "请选择";
                dtSource.Rows.InsertAt(_drNew, 0);
                dtSource.AcceptChanges();
    
                return dtSource;
            }
  • 相关阅读:
    Linux文件和目录管理常用重要命令
    Windows和Linux下Mysql 重置root 密码
    瀑布流vue-waterfall的高度设置
    vue-cli 引入axios及跨域使用
    Vue 脱坑记
    shell基础
    正则
    安装卸载
    压缩打包
    vim工具
  • 原文地址:https://www.cnblogs.com/markli/p/3582055.html
Copyright © 2020-2023  润新知