首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

程序出现参数有冲突 各位指点一上

2013-01-08 
程序出现参数有冲突 各位指点一下下面是一个简单c#程序 但不知怎么出现参数冲突 软件没有给位置给我 不知

程序出现参数有冲突 各位指点一下
下面是一个简单c#程序 但不知怎么出现参数冲突 软件没有给位置给我 不知在何处 怎样改 好晕
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace windows_表单
{
    
    public partial class myfirstwinform: Form
    {
        public myfirstwinform()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {}
            private System.Windows.Forms.Label mytextlabel;
            private System.Windows.Forms.Button mycancelbutton;
            public myfirstwinform()
            {
                //创建对象
                this.mytextlabel=new System.Windows.Forms.Label();
                this.mycancelbutton=new System.Windows.Forms.Button();
                this.Text="我的表单";
                //设置标签
                this.mytextlabel.Location=new System.Drawing.Point(18,24);
                this.mytextlabel.Text="这是一个简单的windows表单";
                this.mytextlabel.Size=new System.Drawing.Size(200,24);
                //设置取消按钮
                 this.mycancelbutton.Location=new System.Drawing.Point(148,200);
                this.mycancelbutton.Size=new System.Drawing.Size(112,24);
                this.mycancelbutton.Text="取消";
                //设置事件
                 mycancelbutton.Click+=new EventHandler(mycancelbutton_Click);
                //添加控件
                this.AutoScaleDimensions=new System.Drawing.Size(5,12);
                this.ClientSize=new System.Drawing.Size(200,200);
                this.Controls.Add(this.mycancelbutton);
                this.Controls.Add(this.mytextlabel);




           }
     
        //退出事件
       
           public static void main()
           {
               Application.Run(new myfirstwinform());
           }

        private void button1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
        
        }              
        }
    }

[解决办法]
两个缺省构造函数

public myfirstwinform() 
        { 
            InitializeComponent(); 
        } 


public myfirstwinform() 
            { 
                //创建对象 
                this.mytextlabel=new System.Windows.Forms.Label(); 
                this.mycancelbutton=new System.Windows.Forms.Button(); 
                this.Text="我的表单"; 
                //设置标签 
                this.mytextlabel.Location=new System.Drawing.Point(18,24); 
                this.mytextlabel.Text="这是一个简单的windows表单"; 
                this.mytextlabel.Size=new System.Drawing.Size(200,24); 
                //设置取消按钮 
                this.mycancelbutton.Location=new System.Drawing.Point(148,200); 
                this.mycancelbutton.Size=new System.Drawing.Size(112,24); 
                this.mycancelbutton.Text="取消"; 
                //设置事件 
                mycancelbutton.Click+=new EventHandler(mycancelbutton_Click); 


                //添加控件 
                this.AutoScaleDimensions=new System.Drawing.Size(5,12); 
                this.ClientSize=new System.Drawing.Size(200,200); 
                this.Controls.Add(this.mycancelbutton); 
                this.Controls.Add(this.mytextlabel); 


          } 
    
[解决办法]
合并为一个:


public myfirstwinform() 
        { 
            InitializeComponent(); 
                    //创建对象 
                this.mytextlabel=new System.Windows.Forms.Label(); 
                this.mycancelbutton=new System.Windows.Forms.Button(); 
                this.Text="我的表单"; 
                //设置标签 
                this.mytextlabel.Location=new System.Drawing.Point(18,24); 
                this.mytextlabel.Text="这是一个简单的windows表单"; 
                this.mytextlabel.Size=new System.Drawing.Size(200,24); 
                //设置取消按钮 
                this.mycancelbutton.Location=new System.Drawing.Point(148,200); 
                this.mycancelbutton.Size=new System.Drawing.Size(112,24); 
                this.mycancelbutton.Text="取消"; 
                //设置事件 
                mycancelbutton.Click+=new EventHandler(mycancelbutton_Click); 
                //添加控件 
                this.AutoScaleDimensions=new System.Drawing.Size(5,12); 
                this.ClientSize=new System.Drawing.Size(200,200); 
                this.Controls.Add(this.mycancelbutton); 
                this.Controls.Add(this.mytextlabel); 


          } 


    


[解决办法]
引用:
合并为一个: 

C# code
public myfirstwinform() 
        { 
            InitializeComponent(); 
                    //创建对象 
                this.mytextlabel=new System.Windows.Forms.Label(); 
                this.mycancelbutton=new System.Windows.Forms.Button(); 
                this.Text="我的表单"; 
                //设置标签 
                this.mytextlabel.Location=new System.…



这个可以!!!

热点排行