Ejemplo n.º 1
0
        /// <summary>
        /// //添加字段按钮点击事件
        /// </summary>
        private void toolStripButtonAddField_Click(object sender, System.EventArgs e)
        {
            AddColumnForm form = new AddColumnForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                property.AddField(form.FieldName, form.FieldType);
                DataGridViewTextBoxColumn txtBoxCol = new DataGridViewTextBoxColumn();
                txtBoxCol.SortMode   = DataGridViewColumnSortMode.NotSortable;
                txtBoxCol.HeaderText = form.FieldName;
                txtBoxCol.Name       = form.FieldName;
                txtBoxCol.ValueType  = form.FieldType;
                dataGridView.Columns.Add(txtBoxCol);
                totalRecords.Columns.Add(new DataColumn(form.FieldName, form.FieldType));
            }
        }