Click here to Skip to main content
14,357,409 members
   

C#

 
JokeRe: Upload encrypted excel file to datagridview Pin
lw@zi 30-Sep-19 0:06
professional lw@zi 30-Sep-19 0:06 
AnswerRe: Upload encrypted excel file to datagridview Pin
OriginalGriff30-Sep-19 2:30
protectorOriginalGriff30-Sep-19 2:30 
QuestionCould Not Decrease right of Non Client in Edit Control Pin
Member 1180360726-Sep-19 7:33
memberMember 1180360726-Sep-19 7:33 
AnswerRe: Could Not Decrease right of Non Client in Edit Control Pin
Richard MacCutchan26-Sep-19 7:42
protectorRichard MacCutchan26-Sep-19 7:42 
AnswerRe: Could Not Decrease right of Non Client in Edit Control Pin
Dave Kreskowiak26-Sep-19 11:23
mveDave Kreskowiak26-Sep-19 11:23 
GeneralRe: Could Not Decrease right of Non Client in Edit Control Pin
Member 1180360726-Sep-19 22:54
memberMember 1180360726-Sep-19 22:54 
AnswerRe: Could Not Decrease right of Non Client in Edit Control Pin
OriginalGriff27-Sep-19 0:38
protectorOriginalGriff27-Sep-19 0:38 
Question[VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661326-Sep-19 6:03
professionalsteve_949661326-Sep-19 6:03 
Hello everybody.

My application runs in Windows Embedded Compact 7,is written in C# and it uses .NET Compact Framework 3.5.

In the application there is a form, I call it FormMain, two UserControlls, Page01_UC and SetupHome_UC, another form, FormDateTime.

In FormMain i declared:
public static Page01_UC uc1 = new Page01_UC();
public static SetupHome_UC uc2 = new SetupHome_UC();
public static FormDateTime uc3 = new FormDateTime();

In the FormMain load event:
uc1.Parent = this;
uc1.Location = new Point(0, 0);
uc1.Page02_UC_Load(); //something to do at startup
uc1.Show();

In the uc1 UserControl there is a checkbox used to show SetupHome_UC:
private void SetupCB_CheckStateChanged(object sender, EventArgs e)
{
  if (SetupCB.Checked)
  {
    FormMain.uc1.Hide();
    FormMain.uc2.Parent = FormMainRef; //reference to FormMain
    FormMain.uc2.Location = new Point(0, 0);
    FormMain.uc2.Page02_UC_Load(); //something to do at startup
    FormMain.uc2.Show();

    SetupCB.Checked = false;
  }
}

In uc2 UserControl ther is a button to show FormDateTime:
private void DateTimeBt_Click(object sender, EventArgs e)
{
  FormMain.uc3.ShowDialog();
}

...at the end... in uc3 there is a button to close the form:
private void AbortBt_Click(object sender, EventArgs e)
{
  Close();
}

I can show/close uc3 (FormDateTime) many times without problems but sometimes it happens that I get an ObjectDisposedException when I push the button to show uc3.

I thought that uc3 should not be disposed but it seems that sometimes it happens.

Have I made any mistakes that I don't see?

There is a way to make uc3 UNdisposable until the application is closed?
...or any other way to avoid this problem...

Thanks in advance.
AnswerRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
#realJSOP26-Sep-19 6:46
mve#realJSOP26-Sep-19 6:46 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661326-Sep-19 21:47
professionalsteve_949661326-Sep-19 21:47 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
#realJSOP26-Sep-19 23:53
mve#realJSOP26-Sep-19 23:53 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
lw@zi 27-Sep-19 2:09
professional lw@zi 27-Sep-19 2:09 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
#realJSOP27-Sep-19 6:45
mve#realJSOP27-Sep-19 6:45 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661329-Sep-19 21:48
professionalsteve_949661329-Sep-19 21:48 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
lw@zi 30-Sep-19 0:04
professional lw@zi 30-Sep-19 0:04 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
#realJSOP30-Sep-19 2:11
mve#realJSOP30-Sep-19 2:11 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661330-Sep-19 2:44
professionalsteve_949661330-Sep-19 2:44 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
#realJSOP30-Sep-19 3:00
mve#realJSOP30-Sep-19 3:00 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661330-Sep-19 22:27
professionalsteve_949661330-Sep-19 22:27 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
lw@zi 30-Sep-19 3:04
professional lw@zi 30-Sep-19 3:04 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661330-Sep-19 2:39
professionalsteve_949661330-Sep-19 2:39 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
#realJSOP30-Sep-19 3:02
mve#realJSOP30-Sep-19 3:02 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661330-Sep-19 3:30
professionalsteve_949661330-Sep-19 3:30 
AnswerRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
lw@zi 27-Sep-19 2:08
professional lw@zi 27-Sep-19 2:08 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661327-Sep-19 2:52
professionalsteve_949661327-Sep-19 2:52 

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.