Microsoft Communities

Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

How can I reset the settings?

The sample code below will do that – it simply uses a named set of settings that captures the state before any custom settings are applied. Then, with button click or whatever you can apply the custom set.

private void Form1_Load(object sender, EventArgs e)
{
// save out a snapshop of init component
ToolStripManager.SaveSettings(this, "RESET");

// load and apply settings last saved
ToolStripManager.LoadSettings(this);
}

private void newToolStripMenuItem_Click(object sender, EventArgs e)
{
// apply the RESET settings
ToolStripManager.LoadSettings(this, "RESET");
}

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
// Save out current state of ToolStrips
ToolStripManager.SaveSettings(this);
}


Page view counter