ComboBox 相似搜索

来源:互联网 发布:印度发展现状知乎 编辑:程序博客网 时间:2024/06/05 16:59
 else if (i % 2 == 1)
                    {
                        string type = dt.Rows[i]["PARAM03"].ToString().Trim();
                        if (type == "ComboBox")
                        {
                            ComboBox tb_Input = new ComboBox();
                            tb_Input.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                            tb_Input.AutoCompleteSource = AutoCompleteSource.ListItems;
                            tb_Input.Name = "tb_Input" + dt.Rows[i]["PARAM05"].ToString().Trim();
                            tb_Input.Size = new Size(250, 50);
                            tb_Input.Font = new Font("Calibri", 12);
                            tb_Input.Location = new Point(width2, heigh2 * (i - z));
                            this.groupBox3.Controls.Add(tb_Input);
                            if (dt.Rows[i]["PARAM10"].ToString().Trim() != "")
                            {
                                //tb_Input.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
                                sql = dt.Rows[i]["PARAM10"].ToString().Trim();
                                exe = this.dbtools.ExecuteQueryWithoutParams(sql, "N");
                                if (!exe.Status)
                                {
                                    MessageBox.Show(exe.Message);
                                    return;
                                }
                                ds = (DataSet)exe.Anything;
                                if (ds.Tables[0].Rows.Count > 0)
                                {
                                    tb_Input.Items.Clear();
                                    tb_Input.Items.Add("");
                                    for (j = 0; j < ds.Tables[0].Rows.Count; j++)
                                    {
                                        tb_Input.Items.Add(ds.Tables[0].Rows[j][0].ToString());
                                    }
                                }
                            }
                        }
                        else if (type == "TextBox")
                        {
                            TextBox tb_Input = new TextBox();
                            tb_Input.Name = "tb_Input" + dt.Rows[i]["PARAM05"].ToString().Trim();
                            tb_Input.Size = new Size(250, 50);
                            tb_Input.Font = new Font("Calibri", 12);
                            tb_Input.Location = new Point(width2, heigh2 * (i - z));
                            this.groupBox3.Controls.Add(tb_Input);
                        }
                        z++;
                    }
                }
原创粉丝点击