Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data;
using System.Drawing;
using System.Text;
using System.Diagnostics;

namespace ExucuteBatFile
{
public partial class Form1 : Form
{
public Form1()
{


}
private void button1_Click(object sender, EventArgs e)
{
Process proc = null;
try
{
string batDir = string.Format(@"D:\EWA\TABLESPACE");
proc = new Process();
proc.StartInfo.WorkingDirectory = batDir;
proc.StartInfo.FileName = "JOB_TABLESPACE.bat";
proc.StartInfo.CreateNoWindow = false;
proc.Start();
MessageBox.Show("Bat telah di executable !!");
}
catch(Exception ex)
{
Console.WriteLine(ex.StackTrace.ToString());
}
}
}
}

What I have tried:

c# error Type 'Form1' already defines a member called '.ctor' with the same parameter types
Posted
Updated 28-Nov-18 19:30pm
Comments
Ehsan Sajjad 28-Nov-18 23:16pm    
error is pretty clear, you have more than 1 constructor overload defined multiple times. remove one of them.

1 solution

This is a partial class - which means that it is spread across multiple files.
Use Visual Studio to do a Find operation:
Open the "Edit" menu, then the "Find and Replace" ... "Find in Files"
Under "Find what" type "Form1" and select "Look in" to be "Current project"
Click the Find All Button.
In the "Find Results" window you will get a list of all the places it is referenced - check the number of constructors (you can double click a line to go directly to it)
You will have two constructors with the same parameter list.
 
Share this answer
 
Comments
Member 14070984 29-Nov-18 4:03am    
still no solve the promblem, can any way to solve this?
OriginalGriff 29-Nov-18 4:27am    
We can't solve this for you: we don't have any access to your machine, and that is what you need.

So it is going to be up to you: it's a compilation error that we can't possibly duplicate here.

Try an experiment: close your solution, create a new one, add a button to it, and double click the button. Add your handler code - and just the handler code - from above, and compile. Does the error go away?
Ionica Ionica 17-Sep-19 16:03pm    
I had also this problen few times and is a bug in VS (maybe because of changing project settings to many times...). The only way to deal with this is to create a new solution and to copy all the code files(.cs,.vb,.html,...etc.) from the old solution to the new one and will work...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900