Click here to Skip to main content
15,911,715 members
Home / Discussions / C#
   

C#

 
QuestionPublic and protected property Pin
Fernando A. Gomez F.10-Oct-07 11:07
Fernando A. Gomez F.10-Oct-07 11:07 
AnswerRe: Public and protected property Pin
Patrick Etc.10-Oct-07 11:08
Patrick Etc.10-Oct-07 11:08 
GeneralRe: Public and protected property Pin
Fernando A. Gomez F.10-Oct-07 11:13
Fernando A. Gomez F.10-Oct-07 11:13 
GeneralRe: Public and protected property Pin
Patrick Etc.10-Oct-07 11:44
Patrick Etc.10-Oct-07 11:44 
GeneralRe: Public and protected property Pin
Skippums10-Oct-07 11:23
Skippums10-Oct-07 11:23 
GeneralRe: Public and protected property Pin
Patrick Etc.10-Oct-07 11:44
Patrick Etc.10-Oct-07 11:44 
GeneralRe: Public and protected property Pin
Robert Rohde10-Oct-07 11:45
Robert Rohde10-Oct-07 11:45 
QuestionToolStripManager.LoadSettings exception Pin
Skippums10-Oct-07 10:42
Skippums10-Oct-07 10:42 
I am getting an ArgumentNullException when I call ToolStripManager.LoadSettings(this) from a form on load event within the application. My scenario is as follows...

public class Panel1 : UserControl {
// This class contains a ToolStripContainer with a unique name, and some toolstrips
}

public class Form1 : Form {
private ToolStripContainer myToolStripContainer;

public Form1() {
Panel1 myPanel = new Panel1();
ToolStripContainer tsc = null;
// Get the ToolStripContainer from myPanel
foreach (Control c in myPanel.Controls) {
if (c is ToolStripContainer) {
tsc = (ToolStripContainer) c;
break;
}
}
// Sets up the default layout
if (tsc != null) {
/* Take all the ToolStrips from myPanel and add them to
* myToolStripContainer in a single row
*/
}
}

protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
// Get the saved layout if it exists (throws unexpected exception)
ToolStripManager.LoadSettings(this);
}

protected override void OnFormClosing(FormClosingEventArgs e) {
base.OnFormClosing(e);
ToolStripManager.SaveSettings(this);
}
}

Does anyone have any idea as to how I can save and reload these settings? I have copied the exception below. Thanks,


ArgumentNullException
"value cannot be null"
at System.Windows.Forms.ToolStripItemCollection.CheckCanAddOrInsertItem(ToolStripItem value)
at System.Windows.Forms.ToolStripItemCollection.Insert(Int32 index, ToolStripItem value)
at System.Windows.Forms.ToolStripSettingsManager.ApplyToolStripSettings(ToolStrip toolStrip, SettingsStub settings, Dictionary`2 itemLocationHash)
at System.Windows.Forms.ToolStripSettingsManager.ApplySettings(ArrayList toolStripSettingsToApply)
at System.Windows.Forms.ToolStripSettingsManager.Load()
at System.Windows.Forms.ToolStripManager.LoadSettings(Form targetForm, String key)
at System.Windows.Forms.ToolStripManager.LoadSettings(Form targetForm)
at Form1_Load(Object sender, EventArgs e) in ...

Jeff
AnswerRe: ToolStripManager.LoadSettings exception Pin
Pete O'Hanlon10-Oct-07 10:50
mvePete O'Hanlon10-Oct-07 10:50 
GeneralRe: ToolStripManager.LoadSettings exception Pin
Skippums10-Oct-07 10:57
Skippums10-Oct-07 10:57 
QuestionChecking for database concurrency violations Pin
msx2310-Oct-07 10:14
msx2310-Oct-07 10:14 
AnswerRe: Checking for database concurrency violations Pin
Robert Rohde10-Oct-07 11:50
Robert Rohde10-Oct-07 11:50 
GeneralRe: Checking for database concurrency violations Pin
msx2311-Oct-07 12:30
msx2311-Oct-07 12:30 
QuestionHow to convert a char from IO stream into an int please Pin
humblepgmr10-Oct-07 9:46
humblepgmr10-Oct-07 9:46 
AnswerRe: How to convert a char from IO stream into an int please Pin
Pete O'Hanlon10-Oct-07 9:49
mvePete O'Hanlon10-Oct-07 9:49 
GeneralRe: How to convert a char from IO stream into an int please Pin
humblepgmr10-Oct-07 10:05
humblepgmr10-Oct-07 10:05 
GeneralRe: How to convert a char from IO stream into an int please Pin
Matthew Cuba10-Oct-07 10:18
Matthew Cuba10-Oct-07 10:18 
QuestionSet a psw to a directory Pin
mcaos10-Oct-07 9:30
professionalmcaos10-Oct-07 9:30 
QuestionRe: Set a psw to a directory Pin
TJoe10-Oct-07 9:33
TJoe10-Oct-07 9:33 
AnswerRe: Set a psw to a directory Pin
Giorgi Dalakishvili10-Oct-07 9:42
mentorGiorgi Dalakishvili10-Oct-07 9:42 
AnswerRe: Set a psw to a directory Pin
mcaos10-Oct-07 10:43
professionalmcaos10-Oct-07 10:43 
GeneralRe: Set a psw to a directory Pin
Dave Kreskowiak10-Oct-07 15:08
mveDave Kreskowiak10-Oct-07 15:08 
GeneralRe: Set a psw to a directory Pin
TJoe11-Oct-07 2:35
TJoe11-Oct-07 2:35 
GeneralRe: Set a psw to a directory Pin
mcaos13-Oct-07 6:43
professionalmcaos13-Oct-07 6:43 
Questionms office current open files Pin
s3rro10-Oct-07 9:16
s3rro10-Oct-07 9:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.