I am working on my first Windows Form App and I need to pass a string from one function to another. My code is rather long at this point so I made a small example that is reproducing the same error.
All that I am trying to do is take the created string from Create()
and pass it into Gets()
. I have done this with C++ but I cannot seem to figure it out with C#.
private void Create()
{
string a;
a = "This is a test";
Gets(a);
}
private void Gets(string b)
{
MessageBox.Show(b);
}
private void button1_Click(object sender, EventArgs e)
{
Gets(); //error CS1501: No overload for method 'Gets' takes 0 arguments
}