c# - How can I take a parameter or call a function which is declared in other braces? -



c# - How can I take a parameter or call a function which is declared in other braces? -

i'm beginner in c# , having great difficulty figure our issues. hope terminology not matter. here question. let's have next code:

namespace windowsformsapplication8 { public partial class form1 : form { public form1() { initializecomponent(); //code starts //... //if(...) { //... //string parameter = abc.tostring(); //} //code ends }//form1 ends private void button1_click(object sender, eventargs e) { //code here } private void button2_click(object sender, eventargs e) { textbox1.text = parameter; button1.perform(); } } }

i have difficulties here.

how can utilize string declared in form1 called parameter within button2_click? textbox1.text = parameter; doesn't work.

use fellow member variable.

public partial class form1 : form { private string parameter = null; public form1() { initializecomponent(); // ... parameter = abc.tostring(); }

c# invoke

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

SQL Server : need assitance parsing delimted data and returning a long concatenated string -