Click here to Skip to main content
15,886,137 members
Home / Discussions / C#
   

C#

 
JokeRe: Upload encrypted excel file to datagridview Pin
dan!sh 29-Sep-19 23:06
professional dan!sh 29-Sep-19 23:06 
AnswerRe: Upload encrypted excel file to datagridview Pin
OriginalGriff30-Sep-19 1:30
mveOriginalGriff30-Sep-19 1:30 
QuestionCould Not Decrease right of Non Client in Edit Control Pin
Member 1180360726-Sep-19 6:33
Member 1180360726-Sep-19 6:33 
AnswerRe: Could Not Decrease right of Non Client in Edit Control Pin
Richard MacCutchan26-Sep-19 6:42
mveRichard MacCutchan26-Sep-19 6:42 
AnswerRe: Could Not Decrease right of Non Client in Edit Control Pin
Dave Kreskowiak26-Sep-19 10:23
mveDave Kreskowiak26-Sep-19 10:23 
GeneralRe: Could Not Decrease right of Non Client in Edit Control Pin
Member 1180360726-Sep-19 21:54
Member 1180360726-Sep-19 21:54 
AnswerRe: Could Not Decrease right of Non Client in Edit Control Pin
OriginalGriff26-Sep-19 23:38
mveOriginalGriff26-Sep-19 23:38 
Question[VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661326-Sep-19 5:03
professionalsteve_949661326-Sep-19 5: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:
C#
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:
C#
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:
C#
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:
C#
private void DateTimeBt_Click(object sender, EventArgs e)
{
  FormMain.uc3.ShowDialog();
}

...at the end... in uc3 there is a button to close the form:
C#
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 5:46
mve#realJSOP26-Sep-19 5:46 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661326-Sep-19 20:47
professionalsteve_949661326-Sep-19 20:47 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
#realJSOP26-Sep-19 22:53
mve#realJSOP26-Sep-19 22:53 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
dan!sh 27-Sep-19 1:09
professional dan!sh 27-Sep-19 1:09 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
#realJSOP27-Sep-19 5:45
mve#realJSOP27-Sep-19 5:45 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661329-Sep-19 20:48
professionalsteve_949661329-Sep-19 20:48 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
dan!sh 29-Sep-19 23:04
professional dan!sh 29-Sep-19 23:04 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
#realJSOP30-Sep-19 1:11
mve#realJSOP30-Sep-19 1:11 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661330-Sep-19 1:44
professionalsteve_949661330-Sep-19 1:44 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
#realJSOP30-Sep-19 2:00
mve#realJSOP30-Sep-19 2:00 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661330-Sep-19 21:27
professionalsteve_949661330-Sep-19 21:27 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
dan!sh 30-Sep-19 2:04
professional dan!sh 30-Sep-19 2:04 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661330-Sep-19 1:39
professionalsteve_949661330-Sep-19 1:39 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
#realJSOP30-Sep-19 2:02
mve#realJSOP30-Sep-19 2:02 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661330-Sep-19 2:30
professionalsteve_949661330-Sep-19 2:30 
AnswerRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
dan!sh 27-Sep-19 1:08
professional dan!sh 27-Sep-19 1:08 
GeneralRe: [VS2008 - Compact Framework] How to prevent a closed form from been disposed Pin
steve_949661327-Sep-19 1:52
professionalsteve_949661327-Sep-19 1: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.