c# - How to return answer from textbox -


i have code user inputs information textbox , want return information string can access other places in code. (subquestion - i've searched everywhere - what's name blocks of code under "private void")

private string searchjobnotextbox_textchanged(object sender, eventargs e) {   string ssearchjobno = searchjobnotextbox.text;   return ssearchjobno; } 

your method handling textchanged event can't return anything, should void.

also - can access textbox text anywhere in form class. if need somewhere outside form - can create public (or internal - depending on scope need access it) method (or property) returning it.

something

public string searchjobno {     { return searchjobnotextbox.text; } } 

then able access value yourform.searchjobno

and answer on subquestion: name blocks of code under "private void" - "method".


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -