Ejemplo n.º 1
0
        private void loadDataGridView()
        {
            dataGridView1.DataSource = null;
            dataGridView1.Columns.Clear();
            dataGridView1.Refresh();
            if (textBox1.Text == "" || textBox1.Text.Length <= 3)
            {
                dataGridView1 = Module.MydataGridView(dataGridView1);
                DataTable dt = TypeController.getListType();
                if (dt.Rows.Count > 0)
                {
                    dataGridView1.DataSource         = TypeController.getListType();
                    dataGridView1.Columns[0].Visible = false;
                }
            }
            else
            {
                dataGridView1            = Module.MydataGridView(dataGridView1);
                dataGridView1.DataSource = TypeController.FindType(textBox1.Text);
            }


            DataGridViewButtonColumn testButtonColumn = new DataGridViewButtonColumn();

            testButtonColumn.Name       = "delete";
            testButtonColumn.Text       = "Xóa";
            testButtonColumn.HeaderText = "";
            testButtonColumn.UseColumnTextForButtonValue = true;

            int columnIndex = dataGridView1.Columns.Count;

            dataGridView1.Columns.Insert(columnIndex, testButtonColumn);
        }
Ejemplo n.º 2
0
        public static ComboBox LoadComboboxLoai(ComboBox comboBox)
        {
            DataTable dt = new DataTable();

            dt = TypeController.getListType();


            comboBox.DataSource    = dt;
            comboBox.DisplayMember = "Loại";
            comboBox.ValueMember   = "Mã Số";
            comboBox.DropDownStyle = ComboBoxStyle.DropDownList;

            return(comboBox);
        }