I have created a string in (e.g. Button1_click)
Call that string "textboxtext"
now for some basic text to assign to the string I did the following
public void button1_Click(object sender, EventArgs e)
{
string textboxtext;
textboxtext = textBox1.Text;
textboxtext += textBox2.Text;
textboxtext += textBox3.Text;
//Some other code later on
}
Now later on in my code I have lets say Button2_click SO :
public void button2_Click(object sender, EventArgs e)
{
//I want to call the string textboxtext here so I can edit it but it doesnt let me....
}
I tried changing this part of the code:
public void button1_Click(object sender, EventArgs e)
into:
public string button1_Click(object sender, EventArgs e)
but because I have other code underneathe the current code in button1_click I get the error :
not all code paths return a value
So how can I "call" the string textboxtext from button1_click into button2_click ?