title: Web service function await until another web service function is executed
body: <p>I am new in Async things.I have a web service that return me (in a Windows Phone 8 app) some questions and some answers from DB( 2 functios) When a call the GetQuestions function, I put the question in a ListBox and I want for each question to return me some ansewrs ( GetAnswers method), but I want to be in the listBox like that:
  Question1
  Answer1
  Answer2
  ...
  Question2
  Answer1
  Answer2</p>
  
  <p>The cod below put me in the ListBox like that
  Question1
  Question2
  Question3
  Answer1
  Answer2
  ...</p>
  
  <p>How can I stop GetQuestions method and for each questions to add in the Listbox answers? </p>
  
  <pre><code>      private  void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
      {
             ServiceReference1.Service1SoapClient client = new  ServiceReference1.Service1SoapClient();
             client.GetQuestionsCompleted += client_GetQuestionsCompleted;
             client.GetQuestionsAsync(ID);
      }
  
  
  
      void client_GetQuestionsCompleted(object sender, ServiceReference1.GetQuestionsCompletedEventArgs e)
      {
  
          questions = e.Result.Cast&lt;string&gt;().ToList();
  
              for(int i=0;i&lt;questions.Count;i+=2)
              {
  
       Listbox1.Items.Add(questions[i]);
  
               ServiceReference1.Service1SoapClient client2 = new ServiceReference1.Service1SoapClient();
               client2.GetAnswersCompleted += client2_GetAnswersCompleted;
               client2.GetAnswersAsync(questions[i]);
              }
      }
  
          void client2_GetAnswersCompleted(object sender, ServiceReference1.GetAnswersCompletedEventArgs e)
          {
            answers = e.Result.Cast&lt;string&gt;().ToList();
  
                for (int i = 1; i &lt; answers.Count; i += 2)
                       Listbox1.Items.Add(answers[i]);
  
       }
  </code></pre>