|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;
namespace internet_magic
{
public partial class clnt_log : Form
{
public clnt_log()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string dir = Environment.CurrentDirectory;
if (!dir.Substring(dir.Length - 1, 1).Equals(@"\"))
dir += @"\";
try
{
FileStream file = new FileStream(dir + "clientlog.txt", FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(file);
this.clnt.Text = sr.ReadToEnd();
sr.Close();
file.Close();
}
catch
{
MessageBox.Show("File access denied.Check you security settings.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button2_Click(object sender, EventArgs e)
{
string dir = Environment.CurrentDirectory;
if (!dir.Substring(dir.Length - 1, 1).Equals(@"\"))
dir += @"\";
try
{
FileStream file = new FileStream(dir + "clientlog.txt", FileMode.Create);
file.Close();
}
catch
{
MessageBox.Show("File access denied.Check you security settings.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void clnt_log_Load(object sender, EventArgs e)
{
string dir = Environment.CurrentDirectory;
if (!dir.Substring(dir.Length - 1, 1).Equals(@"\"))
dir += @"\";
try
{
FileStream file = new FileStream(dir + "clientlog.txt", FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(file);
this.clnt.Text = sr.ReadToEnd();
sr.Close();
file.Close();
}
catch
{
MessageBox.Show("File access denied.Check you security settings.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.