ERROR "member names cannot be the same as their enclosing type"

c#

Solution

You can have only constructor matching the name of the class. If it's the declaration of the constructor, then it should be

public FrmEscalacao(string time) {...}

Constructors should not have any return type. And you shouldn't declare it `private`, if it's going to be used to create an instanse of that type; it should be `public`.

Then you should use it:

FrmEscalacao f1 = new FrmEscalacao("your time"); 

that is, you must specify the value for `time` argument of type `string`.

Problem

I need to open a FrmEscalacao that sends information of FrmAdmin to FrmEscalacao with a string called "time" here is the code of FrmAdmin ``` public partial class FrmAdmin : Form { private string time; public FrmAdmin(string time) { InitializeComponent(); this.time = time; } public void btnEscalar_Click(object sender, EventArgs e) { this.Hide(); FrmEscalacao f1 = new FrmEscalacao(); f1.ShowDialog(); } ``` } here is the code of FrmEscalacao ``` public partial class FrmEscalacao : Form { public string time; private void FrmEscalacao (string time) { InitializeComponent(); this.time = time; SQLiteConnection ocon = new SQLiteConnection(Conexao.stringConexao); DataSet ds = new DataSet(); ocon.Open(); SQLiteDataAdapter da = new SQLiteDataAdapter(); da.SelectCommand = new SQLiteCommand("Here is the SQL command"); DataTable table = new DataTable(); da.Fill(table); BindingSource bs = new BindingSource(); bs.DataSource = table; DataTimes.DataSource = bs; ocon.Close(); } ``` And it returns an error at ``` private void FrmEscalacao (string time) ```

Original source