private async void SendButton_Click(object sender, RoutedEventArgs e) { try { WebServiceClient client = new WebServiceClient(); float Cost; if (!float.TryParse(CostTextBox.Text, out Cost)) { MessageBox.Show("Cost has to be numeric"); return; } bool postWasSuccessful = await client.PostCost(UserTextBox.Text, Cost); if (postWasSuccessful) { UserTextBox.Text = ""; CostTextBox.Text = ""; MessageBox.Show("The POST was successful"); } else { MessageBox.Show("The POST was not successful"); } } catch (Exception) { MessageBox.Show("Error Occurred"); } }