private void ButtonExport_Click(object sender, EventArgs e)
        {
            DialogResult result = SaveFileDialogTXN.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                fileListLocation = SaveFileDialogTXN.FileName + ".txt";
                try
                {
                    if (!File.Exists(fileListLocation))
                    {
                        // Create a file to write to.
                        using (StreamWriter sw = File.CreateText(fileListLocation))
                        {
                            foreach (LogObject tranData in LogsData)
                            {
                                sw.WriteLine(tranData.LogDetails.MsgType + "#" + tranData.LogDetails.Transaction + "# Message: \"" + tranData.LogDetails.Message + "\"");
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("File already exists. Please choose another name.");
                    }
                }
                catch { }
            }
        }
Exemplo n.º 2
0
        private void buttonExport_Click(object sender, EventArgs e)
        {
            DialogResult result = SaveFileDialogTXN.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                fileListLocation = SaveFileDialogTXN.FileName + ".txt";
                try
                {
                    if (!File.Exists(fileListLocation))
                    {
                        // Create a file to write to.
                        using (StreamWriter sw = File.CreateText(fileListLocation))
                        {
                            foreach (string tranData in transactionList)
                            {
                                sw.WriteLine(tranData);// + Environment.NewLine
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("File already exists. Please choose another name.");
                    }
                }
                catch { }
            }
        }