// ********************************************* Construction ********************************************* public DropDown(CheckedComboBox ccbParent) { this.ccbParent = ccbParent; InitializeComponent(); this.ShowInTaskbar = false; // Add a handler to notify our parent of ItemCheck events. this.cclb.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.cclb_ItemCheck); }
private void LoadPhong() { DataTable dt = SqlHelper.ExecuteDataset(ConnHHNI, CommandType.Text, "select * from tblTest").Tables[0]; int soCBB = Convert.ToInt32(SqlHelper.ExecuteScalar(ConnHHNI, CommandType.Text, "select max(lever) from tblTest").ToString()); int lcbb = 10, tcbb = 10; CheckedComboBox cbb = new CheckedComboBox(); //cbb.Name = "cbb_" + i.ToString(); cbb.Size = new Size(200, 30); cbb.Location = new Point(lcbb, cbb.Location.Y + cbb.Height + tcbb); this.Controls.Add(cbb); DataRow[] dr = dt.Select("idcha =0"); foreach (DataRow r in dr) { cbbPhong.Items.Add(new ItemCBB(r["Id"].ToString(), r["Ten"].ToString(), "0", Convert.ToInt32(r["Lever"].ToString()))); cbb.Items.Add(new ItemCBB(r["Id"].ToString(), r["Ten"].ToString(), "0")); } cbbPhong.SelectedIndex = 0; }