Hi This is Amol
im running C#.net program.
I executed the program with csc form1.cs command it got compiled correctly
but when i run its exe file form1 it gives error Application failed to inialise properly 0x000007b click ok to terminate it

Please give me proper solution to this error and also reason why this error has occurred


the code is as follows

using System;
using System.Windows.Forms;

public class form2 : System.Windows.Forms.Form
{
System.Windows.Forms.Label lblFirst;
System.Windows.Forms.Label lblLast;
System.Windows.Forms.Label lblMarks;

System.Windows.Forms.TextBox txtFirst;
System.Windows.Forms.TextBox txtLast;
System.Windows.Forms.TextBox txtMarks;

System.Windows.Forms.Button btn;
//System.ComponentModel.Container comp = null;

	public form2()
	{  
InitializeComponent();

}

void InitializeComponent()
{
lblFirst = new System.Windows.Forms.Label();
this.lblFirst.Location=new System.Drawing.Point(300,100);
this.lblFirst.Text = "First Name";

lblLast= new System.Windows.Forms.Label();
this.lblLast.Location=new System.Drawing.Point(300,140);
this.lblLast.Text = "Last Name";

lblMarks= new System.Windows.Forms.Label();
this.lblMarks.Location=new System.Drawing.Point(300,180);
this.lblMarks.Text = "Marks";

txtFirst = new System.Windows.Forms.TextBox();
this.txtFirst.Location=new System.Drawing.Point(350,100);
this.txtFirst.Name="txtFirst";
this.txtFirst.Size = new System.Drawing.Size(150, 150);
this.txtFirst.Text="Hi";

txtLast = new System.Windows.Forms.TextBox();
this.txtLast.Location=new System.Drawing.Point(350,140);
this.txtLast.Name="txtLast";
this.txtLast.Text="Hi";
this.txtLast.Size = new System.Drawing.Size(150, 150);

txtMarks = new System.Windows.Forms.TextBox();
this.txtMarks.Location=new System.Drawing.Point(350,180);
this.txtMarks.Name="txtMarks";
this.txtMarks.Text="HI";
this.txtLast.TabIndex=1;
this.txtMarks.Size = new System.Drawing.Size(150, 150);

this.btn = new System.Windows.Forms.Button();
this.btn.Name = "btn";
this.btn.Text = "Submit";
//this.btn.Size = new System.Drawing.Size(50,50);

this.btn.Location = new System.Drawing.Point(150,150);
//this.btn.Click += new System.EventHandler(this.btn_Click);

System.Windows.Forms.MessageBox.Show("U have entered:" +txtMarks.Text);
 /*public void btn_Click(object sender , System.EventArgs e)
{
MessageBox.Show("U have Entered:"+txtMarks.Text);
}*/


//this.AutoScaleBaseSize = new System.Drawing.Size(120,150);
this.ClientSize = new System.Drawing.Size(800,800);
this.Controls.Add(this.lblFirst);
this.Controls.Add(this.lblLast);
this.Controls.Add(this.lblMarks);
this.Controls.Add(this.txtFirst);
this.Controls.Add(this.txtLast);
this.Controls.Add(this.txtMarks);
this.Controls.Add(this.btn);
this.SuspendLayout();
}
	

 static void Main(String []args)
{
Application.Run(new form2());


}
}

Regards
Amol

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.