当前位置:编程学习 > C#/ASP.NET >>

错误 1 “PDA.Form2.Dispose(bool)”: 没有找到适合的方法来重写

     protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

高手们帮小弟看看怎么解决这个问题
多谢啦
在线等待
--------------------编程问答--------------------
引用楼主 aleen009 的回复:
    protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

高手们帮小弟看看怎么解决这个问题
多谢啦
在线等待
顶 --------------------编程问答-------------------- 难道你也遇到了类似的问题了? --------------------编程问答-------------------- 是不是winpc程序直接复制过来的?可能有些代码不一样,新建个wince/ppc的程序,对照着的不支持的方法替换一下即可。 --------------------编程问答-------------------- 看看命名空间是不是相同~ --------------------编程问答-------------------- namespace PDA
{
    partial class Form2
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.dataGridView1 = new System.Windows.Forms.DataGrid();
            this.button1 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // dataGridView1
            // 
            this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.AppWorkspace;
            this.dataGridView1.Location = new System.Drawing.Point(12, 12);
            this.dataGridView1.Name = "dataGridView1";
            this.dataGridView1.Size = new System.Drawing.Size(463, 237);
            this.dataGridView1.TabIndex = 0;
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(71, 335);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(72, 20);
            this.button1.TabIndex = 1;
            this.button1.Text = "确认";
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // button2
            // 
            this.button2.Location = new System.Drawing.Point(269, 335);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(72, 20);
            this.button2.TabIndex = 2;
            this.button2.Text = "搜索";
            this.button2.Click += new System.EventHandler(this.button2_Click);
            // 
            // Form2
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
            this.AutoScroll = true;
            this.ClientSize = new System.Drawing.Size(638, 455);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.dataGridView1);
            this.Location = new System.Drawing.Point(12, 12);
            this.Name = "Form2";
            this.Text = "菜单";
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.DataGrid dataGridView1;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button button2;
    }
} --------------------编程问答-------------------- 高手们帮小弟解决下吧
不胜感激 --------------------编程问答-------------------- 因为父类中没有这个方法 void Dispose(bool disposing)

protected override void Dispose(bool disposing) 将 override 去掉或在父类中加上这个方法 就ok了 --------------------编程问答--------------------
引用 7 楼 xiyou 的回复:
因为父类中没有这个方法 void Dispose(bool disposing)

protected override void Dispose(bool disposing) 将 override 去掉或在父类中加上这个方法 就ok了

很有可能是父类没有此方法,不过没有的话你能override出来吗?
看看你的父类方法…… --------------------编程问答-------------------- 你自已更了类名或名称空间。
自设计器自动生成代码那边没有同步。 --------------------编程问答--------------------
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,