Member 11192079 Ответов: 0

Как показать скрытую форму ocx


I have a mdi application.Iam hiding and showing many forms. Iam using Form.hide() and form.show() for achieving this.

but when i try to hide and show a form which has a ocx function [used to populate a tree view]. Its showing 
this error "An unhandled exception of type 'System.AccessViolationException' occurred in System.Windows.Forms.dll

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt." 

Code for hiding form :

private void HideAll() 
{ 
    foreach (Form child in this.MdiChildren) 
    { 
        child.Hide(); 
    }
}



This is my code for showing the hidden form:

foreach (Form f in this.MdiChildren)
{
    if (f.Visible == false)
    {
        f.Activate();
        f.Visible = true;
        f.TopMost = true;
     }
}


Could you please tell me if any solutions available


Что я уже пробовал:

Это мой код для отображения скрытой формы:

foreach (форма f в этом.MdiChildren)
{
if (f. Visible = = false)
{
Ф.Активировать();
Ф.Видимое = истинное;
Ф.Верхний = истина;
}
}

0 Ответов