Form.Show(): Cannot access a disposed object
c#, winforms
Solution
Found my code problem. I took one more look at the Stack trace and found i a message "Icon".
this.Icon.Dispose();
Startupform had this line.
This code fixed my problem:
private void resultButton_Click(object sender, EventArgs e)
{
ResultForm rf = new ResultForm(this);
rf.Icon = this.Icon;
rf.Show();
this.Enabled = false;
}
Thanks for the helping hands...
Problem
I have been stuck with this for some time now. I can't open a new form on button click. If i create and `.Show()` form in the start form constructor i will work. I dont get it! :-( StartUp Form ``` public Form1() { InitializeComponent(); startmessage(); br = Logic.loadXML("theshiiiiiittt.xml"); br2 = br.Clone(); loadboxes(); //serializeTest(); t = new Thread(contactDBUpdate); //t.IsBackground = true; t.Start(); } ``` Button event: ``` private void resultButton_Click(object sender, EventArgs e) { ResultForm rf = new ResultForm(this); rf.Show(); this.Enabled = false; } ``` Hope this is enough.