c# - How to control flow from one function to another function -


i trying call chk_condition() function find_output() problem control not moving find_output() function chk_condition() function. possible error?

private void find_output(string a) {     string[] separators = new string[] { "\n" };     foreach (string sent in a.split(separators)     {         listbox8.items.clear();         string sentence = sent.replace("\r", "");         if (sentence != "")         {             int s = sentence.count();             string[] separators1 = new string[] { " " };              foreach (string word in sentence.split(separators1))             {                 listbox8.items.add(word);             }             int word_count = listbox8.items.count;             chk_condition(sentence);             if (condition_satisfy == i)                 textbox6.text = textbox6.text + environment.newline + sentence;         }     } }  private void chk_condition(string a) { } 

assuming code compiles - because there obvious errors** - can debug find_output method check why chk_condition never executed. 1 reason may string a empty or program breaks before reaching chk_condition.

i'm assuming using visual studio. debug:

  1. set breakpoint (f9) @ beginning of find_output.
  2. start application in debug mode (f5).
  3. when breakpoint hit go step step (f10) see line line how code executed.
  4. while debugging use mouse , hover on variables see current values (or use e.g. watch window (ctrl+d,w).
  5. if sentence string not empty reach chk_condition. use step inside (f11) see method executed.

** missing closing bracket in first foreach loop. mysterious i variable - initialized anywhere? have value?


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -