Hi

I created C# project ,but there is problem,the problem is if I click on close button in right side upper corner in windows application while program is running ,then it's close,but I cant compile it in second time because its giving error massage "your Test10.Exe is already running",but there is no Test10.exe running,so what I am doing is I close it from task menu. In task menu it show "Test10 " as running process.What is problem with in coding?.In .NET framework it automatically destroy unwanted objects.Please Help me

Thanks
Tank50

Show us your code. You cannot repair a car when the engine is broken and the hood is closed.

Closing a window doesnot close or terminate an application. Problem shows that your main thread or main window form is still running with hidden state.
However if you want to terminate an application handle the FormClosing event and add following:

Application.Exti();

Hi

Here is coding.Column and SheetFormat are class.

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

namespace Test008
{
    public partial class Frm_XMLCreate : Form
    {
      public static int  count=0;
      public List<Column> Create_Column;
      public  List<SheetFormat> Create_Sheet;
       int No_workbook;
       int No_Column;
       int Sheet_No;
       int start_Row;
       int end_Row;
       int i;



        public Frm_XMLCreate()
        {
            InitializeComponent();
                      
        }
          
      

        private void btn_Save_Click(object sender, EventArgs e)
        {
            count = count + 1;
            No_workbook = Convert.ToInt32(cmb_workBookNo.Text);
            Sheet_No = Convert.ToInt32(cmb_Sheet_No.Text);
            No_Column = Convert.ToInt32(cmb_Column_No.Text);
            Create_Column=new List<Column>();
            start_Row = Convert.ToInt32(txtdatastart.Text);
            end_Row = Convert.ToInt32(txtendrow.Text);
            btn_Save_Column.Enabled = true;
            
        }

      
        }

        private void Frm_XMLCreate_Load(object sender, EventArgs e)
        {
            this.Create_Sheet = new List<SheetFormat>();
        }

        private void btn_Save_Column_Click(object sender, EventArgs e)
        {
     
            if (Create_Column.Count< No_Column)
            {
                Column col1 = new Column((Convert.ToInt32(Cmb_Col_No.Text)), Cmb_Col_Code.Text, Convert.ToInt32(txt_Data_Type.Text), cmb_Data_Type_Name.Text, Convert.ToBoolean(Cmb_Multiple_Data.Text));
                Create_Column.Add(col1);
                Cmb_Col_No.Text = "";
                Cmb_Col_Code.Text = "";
                txt_Data_Type.Text = "";
                Cmb_Multiple_Data.Text = "";
                if (Create_Column.Count == No_Column)
                {
                    btn_Create_WorkSheet.Enabled = true;

                }             
            }
            else
            {
                MessageBox.Show("Column is full");
                
            }

       
        }
        private void btn_Sheet_Click(object sender, EventArgs e)
        {
    
        
                JoinForm J = new JoinForm(this.Create_Sheet);
                this.Hide(); 
                J.Show();
          
        }

        private void cmb_Data_Type_Name_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.Text == "DESTINATION")
            {
                txt_Data_Type.Text= "1";

            }
            if (this.Text == "RATE")
            {
                txt_Data_Type.Text = "2";
            }

            if (this.Text == "Country Code")
            {
                txt_Data_Type.Text = "3";
            }

        }

      

        private void btn_Create_WorkSheet_Click(object sender, EventArgs e)
        {
       
            if (Create_Column != null)
            {
              
               SheetFormat sh1 = new SheetFormat(No_workbook, Sheet_No, Create_Column,start_Row, end_Row);
               this.Create_Sheet.Add(sh1);
                btn_Save_Column.Enabled = false;
                btn_Proceed.Enabled = true;
                btn_Create_WorkSheet.Enabled = false;
            }

         
        }  
        

   
            

        
    }
}

Thanks
Tank50

WorkSheet.... because you use COM, which you didn't terminate it yourself and if you open the task manager you will see Test10.exe is running. Try adatapost help it solves your problem

I think Ramy has the answer here but I also have this happen randomly when everything has been cleaned up properly -- the issue turned out to be the visual studio hosting process. If you go to your project properties then on the left side click debug, the bottom most checkbox defaults to true for "Enable the visual studio hosting process" -- uncheck this for release and debug builds. I turn off the VS hosting process for all of my projects.

Hi

I did what adatapost is saying ,now it working properly.

Thanks
Tank50

I'm glad you found a solution to your problem and good luck.

Please mark this thread solved if your question has been answered.

This question has already been answered. Start a new discussion instead.