Unclickable Buttons

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
User avatar
Eaton




Enthraller

Posts: 1639
Joined: Thu Jun 14, 2007 4:16 pm
Location: USA

Unclickable Buttons

Post by Eaton »

You know how some buttons are unclickable and are grayed out until you open something? Then the button becomes clickable and an event happens. How can I make my button unclickable until a user opens a file in an OpenFileDialog?
Image
User avatar
NotZachary82





Posts: 644
Joined: Sun Oct 28, 2007 9:15 am
Location: TX, USA

Post by NotZachary82 »

Enabled = false

Set that in the properties of the button.

Then you can try this:

Code: Select all

C#
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
{
     button1.Enabled = true;
}
User avatar
Eaton




Enthraller

Posts: 1639
Joined: Thu Jun 14, 2007 4:16 pm
Location: USA

Post by Eaton »

Ah, thank you! :)
Image
Post Reply