C# Help with button
Hi everyone, I have this code where it gets a response from an API and I want it to send to my textbox by pressing a button, but when I run the code and press the button nothing happens.. pls help? Thank you. using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Net.Http; using System.Windows; using System.Windows.Forms; namespace JokeGEN { public partial class Form1 : Form { public Form1() { InitializeComponent(); } static readonly HttpClient client = new HttpClient(); public class Value { public int id { get; set; } public string joke { get; set; } public List<string> categories { get; set; } } public class Root { public string type { get; set; } public Value value { get; set; } } private async System.Threading.Tasks.Task btnjoke_ClickAsync(object sender, EventArgs e) { string responseBody = await client.GetStringAsync("http://api.icndb.com/jokes/random"); Root jokes = JsonConvert.DeserializeObject<Root>(responseBody); string joke = jokes.value.joke; txtjoke.Text = joke; } } }