资源简介

   动态添加删除DataGridView列示例

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        static int colCount = 0; 
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {
            
            DataGridViewTextBoxColumn acCode = new DataGridViewTextBoxColumn(); 
            colCount++;
            acCode.Name = “第“ + colCount.ToString()+‘列‘;
            acCode.DataPropertyName = “第“ + colCount.ToString() + ‘列‘;
            acCode.HeaderText = “第“ + colCoun

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        189  2019-10-12 14:00  WindowsFormsApplication2\App.config

     文件       9728  2019-10-12 14:17  WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.exe

     文件        189  2019-10-12 14:00  WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.exe.config

     文件      26112  2019-10-12 14:17  WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.pdb

     文件      22984  2019-12-03 13:51  WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe

     文件        189  2019-10-12 14:00  WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe.config

     文件        490  2012-06-06 02:06  WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe.manifest

     文件       1341  2019-10-12 14:17  WindowsFormsApplication2\Form1.cs

     文件       3611  2019-10-12 14:16  WindowsFormsApplication2\Form1.Designer.cs

     文件       5817  2019-10-12 14:16  WindowsFormsApplication2\Form1.resx

     文件       1318  2019-12-03 13:50  WindowsFormsApplication2\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7117  2019-10-12 14:00  WindowsFormsApplication2\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件          0  2019-10-12 14:00  WindowsFormsApplication2\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2019-10-12 14:00  WindowsFormsApplication2\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2019-10-12 14:00  WindowsFormsApplication2\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件        944  2019-12-03 13:51  WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.csproj.FileListAbsolute.txt

     文件        975  2019-10-12 14:16  WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.csproj.GenerateResource.Cache

     文件       9728  2019-10-12 14:17  WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.exe

     文件        180  2019-10-12 14:16  WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.Form1.resources

     文件      26112  2019-10-12 14:17  WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.pdb

     文件        180  2019-10-12 14:14  WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.Properties.Resources.resources

     文件        536  2019-10-12 14:00  WindowsFormsApplication2\Program.cs

     文件       1368  2019-10-12 14:00  WindowsFormsApplication2\Properties\AssemblyInfo.cs

     文件       2900  2019-10-12 14:00  WindowsFormsApplication2\Properties\Resources.Designer.cs

     文件       5612  2019-10-12 14:00  WindowsFormsApplication2\Properties\Resources.resx

     文件       1111  2019-10-12 14:00  WindowsFormsApplication2\Properties\Settings.Designer.cs

     文件        249  2019-10-12 14:00  WindowsFormsApplication2\Properties\Settings.settings

     文件       3829  2019-10-12 14:14  WindowsFormsApplication2\WindowsFormsApplication2.csproj

     文件        962  2019-10-12 14:00  WindowsFormsApplication2.sln

    ..A..H.     39424  2019-12-03 13:52  WindowsFormsApplication2.v11.suo

............此处省略10个文件信息

评论

共有 条评论