Compiler Error CS0201

G

Guest

I get this error when I try to perform;

Application.Exit;

Here is the code from my form;

using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace DatReader
{
public partial class frmMainForm : Form
{
public frmMainForm()
{
InitializeComponent();
}
private void btnLoad_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "dat files (*.dat)|*.dat|All files (*.*)|*.*";
dlg.InitialDirectory = @"D:\";
dlg.CheckFileExists = false;
if (dlg.ShowDialog() == DialogResult.OK)
{
string path = dlg.FileName;
if (File.Exists(@"D:\") != true)
rtbTextBox.Text = Streamer.LayoutInput(dlg.FileName);
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit;
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "dat files (*.dat)|*.dat|All files (*.*)|*.*";
dlg.InitialDirectory = @"D:\";
dlg.CheckFileExists = false;
if (dlg.ShowDialog() == DialogResult.OK)
{
string path = dlg.FileName;
if (File.Exists(@"D:\") != true)
rtbTextBox.Text = Streamer.LayoutInput(dlg.FileName);
}
}
private void higlightTextToolStripMenuItem_Click(object sender,
EventArgs e)
{

}
private void searchTextToolStripMenuItem_Click(object sender,
EventArgs e)
{

}
private void filtersToolStripMenuItem_Click(object sender, EventArgs
e)
{

}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Run(new frmAbout());
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit;
}
}
}
 
G

G.Doten

Brian said:
I get this error when I try to perform;

Application.Exit;

Here is the code from my form;

using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace DatReader
{
public partial class frmMainForm : Form
{
public frmMainForm()
{
InitializeComponent();
}
private void btnLoad_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "dat files (*.dat)|*.dat|All files (*.*)|*.*";
dlg.InitialDirectory = @"D:\";
dlg.CheckFileExists = false;
if (dlg.ShowDialog() == DialogResult.OK)
{
string path = dlg.FileName;
if (File.Exists(@"D:\") != true)
rtbTextBox.Text = Streamer.LayoutInput(dlg.FileName);
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit;
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "dat files (*.dat)|*.dat|All files (*.*)|*.*";
dlg.InitialDirectory = @"D:\";
dlg.CheckFileExists = false;
if (dlg.ShowDialog() == DialogResult.OK)
{
string path = dlg.FileName;
if (File.Exists(@"D:\") != true)
rtbTextBox.Text = Streamer.LayoutInput(dlg.FileName);
}
}
private void higlightTextToolStripMenuItem_Click(object sender,
EventArgs e)
{

}
private void searchTextToolStripMenuItem_Click(object sender,
EventArgs e)
{

}
private void filtersToolStripMenuItem_Click(object sender, EventArgs
e)
{

}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Run(new frmAbout());
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit;
}
}
}

Because Exit is a method, not a property. Try this:

Application.Exit();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top