title: How to pre fill Windows Forms controls on form load event from Web API?
body: <p>I have a solution with two projects: One web API and the other one is a Windows Forms application. In the Windows Forms application I send a get request to retrieve some data. So I have a method like this:</p>
  
  <pre><code>private async Task StartFillingEvent()
  {
      var path = "api/Windows/GetEventNames/";
      List&lt;EventItemDto&gt; events = null;
      HttpResponseMessage response = await client.GetAsync(path);
      if (response.IsSuccessStatusCode)
      {
          events = await response.Content.ReadAsAsync&lt;List&lt;EventItemDto&gt;&gt;();
          var eventList = (from c in events
                              select new ListItemVm&lt;Guid&gt;()
                              {
                                  Id = c.EventId,
                                  Name = c.Title
                              }).ToList();
  
          eventsDrp.FillDropDownList&lt;Guid&gt;("Please choose one", eventList, null);
      }
  }
  </code></pre>
  
  <p>which gets my data and in form_Load i call this method:</p>
  
  <pre><code>private void frmOnlineBadge_Load(object sender, EventArgs e)
  {
      StartFillingEvent().Wait();
  }
  </code></pre>
  
  <p>I traced my application it goes to web API and retrieves data to the Windows Forms application. But the application sleeps in the <code>if</code> statement. I have no knowledge of multi threading. My goal is to interact with the web API. I googled and i found lots of tutorials with windows console application not with Windows Forms. I checked my program with console application but I have to work with controls in Forms application. </p>
  
  <p>How can I manage this data retrieval?</p>