KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am working on something fairly simple, well I thought it would be. What I want is when button1 is clicked I want it to disable button1 and enable button2. I get the error below: Error 1 Only assignment, call, increment, decrement, and new object expressions can be used as a statement. private readonly Process proc = new Process(); public Form1() { InitializeComponent(); button2.Enabled = false; } private void button1_Click(object sender, EventArgs e) { proc.StartInfo = new ProcessStartInfo { FileName = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + "/explorer.exe", Arguments = @"D:\", UseShellExecute = false }; proc.Start(); button1.Enabled = false; button2.Enabled = true; } private void button2_Click(object sender, EventArgs e) { proc.Kill(); button1.Enabled = true; button2.Enabled = false; }
Tags (comma-separated)
Save Edits
Cancel