private async void button1_Click(object sender, EventArgs e) { CognitoHelper cognitoHelper = new CognitoHelper(); bool success = await cognitoHelper.VerifyAccessCode(lblusername.Text, txtcode.Text); if (success) { MessageBox.Show("Able to validate the access code"); this.Close(); } else { MessageBox.Show("Unable to validate the access code"); } }