zoukankan      html  css  js  c++  java
  • checkedListBox使用例子

      #region 初始化资料查询界面
            public void InitFeelsInfoGrid()
            {
                EatGood.Model.FoodManage.SearchFeelKind model = new EatGood.Model.FoodManage.SearchFeelKind();

                model.FShopId = fshopid.ToString();


                #region 动态组织SQL语句
                string stre = null;
                for (int i = 0; i < checkedListBox2.Items.Count; i++)
                {
                    if (checkedListBox2.GetItemChecked(i))
                    {
                        stre += "FeelKindName in('" + checkedListBox2.GetItemText(checkedListBox2.Items[i]) + "') or ";
                    }
                }
                if (stre != null)
                {
                    model.FeelKindName = strw + "(" + stre.Substring(0, stre.Length - 3) + ")";
                }
                stre = null;
                for (int i = 0; i < checkedListBox3.Items.Count; i++)
                {
                    if (checkedListBox3.GetItemChecked(i))
                    {
                        stre += "kindname in('" + checkedListBox3.GetItemText(checkedListBox3.Items[i]) + "') or ";
                    }
                }
                if (stre != null)
                {
                    model.Kindname = strw + "(" + stre.Substring(0, stre.Length - 3) + ")";
                }

                #endregion
                model.FeelNo = textBox1.Text.Trim();
                model.FeelName = textBox2.Text.Trim();
                SQL = model.GetSQLFromTempl();
                DataSet ds = sfk.SearchFeelsInfo(SQL);
                BindFeelsInfoGrid(ds);
            }

            private void BindFeelsInfoGrid(DataSet ds)
            {
                SongTao3 st3 = new SongTao3();
                st3.Show();
                this.Hide();
                if (checkBox1.Checked)
                {
                    st3.dataGridView1.DataSource = ds.Tables[0].DefaultView;
                }
                else
                {
                    st3.dataGridView1.DataSource = ds.Tables[0].DefaultView;
                    st3.dataGridView1.Columns.Remove("comname");
                }
            }
            #endregion 

  • 相关阅读:
    【转】HTTP 状态码详解
    程序员自我提升之粗粮与细粮
    配置Eclipse支持MacBook Pro Retina屏幕的办法(解决Retina屏幕下eclipse字体变虚的问题)
    IE6下lineheight失效:当文字与图片img在同一行中显示时lineheight失效的解决办法
    2013年第二周的总结
    为什么这么多的云存储产品却没有一个能够统一管理它们的应用出现
    微软的云笔记:OneNote+SkyDrive
    完美的外出上网解决方案随身随地享用你的专有WIFI网络(3G无线路由器+sim卡卡托+3G资费卡)
    [转]如何才能更加有效率
    Perl Note
  • 原文地址:https://www.cnblogs.com/a1991322/p/2650714.html
Copyright © 2011-2022 走看看