private async void btnProcess_Click(object sender, EventArgs e) { txtResults.Text = PDFread.GetPdfPageText(txtFilePath.Text, 1); /*Send to data parser for value extraction*/ //DataClass parsedData = VendorSelection.ParseData(txtResults.Text); /*Send result of parser to db as c# objects*/ Db db = new Db("http://localhost:5984", "pdf_receipts", "tempAdmin", "gH5sE2*61Lu"); var result = await db.AddDoc(VendorSelection.ParseData(txtResults.Text)); if (result) { // success dialog and continue writing to file MessageBox.Show("Success!"); writeToFile(); } else { // failure alert and stop writing to file MessageBox.Show("Failure"); } }