string pathLote = string.Empty; if (cklbFuncao.GetItemChecked(1) & (go == true)) { txtLog.Text += "Método: nfse.GeraLote\r\n"; pathLote = nfse.GeraLote(path + "RPS-" + nRPS + ".xml", Convert.ToInt32(txtnNFSe.Text)); str = "#RETORNO: " + pathLote; txtLog.Text += str + "\r\n\r\n"; if (File.Exists(pathLote)) go = true; else { go = false; txtLog.Text += "*** ATENÇÃO ***\r\nArquivo de Lote não localizado.\r\n" + pathLote + "\r\n\r\n"; } Application.DoEvents(); }