Strange Problem with Winforms on .NET 1.1: form remains disabled

  • Thread starter Thread starter Stefano
  • Start date Start date
S

Stefano

Dear Friends,
i have a project where a form named Form1 call another form named
Form2.
In a button of Form1 i call Form2.Show() and all works.
In the Closing events of Form2 i have insert this two lines of code:

Visible = false;
e.Cancel = true;

so that i DON'T close really the form but only hide it.
The strange happened when i call Form2.Show() again.
The Form2 go visible but apparently disabled.
i have the title bar grayed, i cannot click any button inside it, i
cannot click the close and the restore butto, but I CAN DOUBLE-CLICK
the title bar and the forms go maximized, i can CLICK on title bar and
move the form and i can CLOSE it via program bar.
In .NET 1.0 all works FINE !!!
in .NET 1.1 i have this behaviour

Could someone help me?
Thanks a lot
Stefano
 
Stefano,

I have .NET Framework 1.1 installed and I wasn't able to reproduce your
problem. Can you give us more details and show us some code?

Gabriele
 
I have made a mistake with my news reader and this is because you
cannot see the file and the steps in this thread but in 2 other
separate message.
Sorry again
Stefano
 
Stefano,

I was able to pin down the origin of the problem, but unfortunately I don't
see anything wrong with your code.

The culprit is the following line in QueryForm.cs/AggiornaGrid():

gridQuery.DataSource = dt;

The documentation says to use the DataGrid SetDataBinding() method to change
the DataSource and DataMember properties at run-time. However, even
replacing that line of code doesn't solve the problem.

I would say it's a DataGrid bug, but hopefully somebody from Microsoft will
look into this issue.

Gabriele
 
Gabriele
i have prepared another small project for testing this behaviour and i
hope that someone at Microsoft will be interested to solve this very
annoying issue that is non present in .NET 1.0.
Thanks to all
Stefano
 
Stefano,

I was running the sample application, and the second form was working fine
for a while then it locked. It seems to be a random behavior.

Gabriele
 
This is not a surprise for me ???
I have found two others "strange" behaviour.

1)
If you don't write this line of code
grid.DataSource = null;

before this one in the AggiornaGrid method

grid.DataSource = dt;

and you comment the
Visible = false;

rows in the Closing and Click Event

you will see another strange error when you click on View table the
second time (getting an exception)


Another issue
2)
Click on the View table button you could see the windows
Move the windows and DON'T close it

Select in the combo box ANOTHER table "Calciatori"
and click View Table again.

Well, from this moment you can close, open view hide move every
windows everytime and all works FINE !!!!!!!!!!!!

I don't have more words !!!!

I think that this RANDOM behaviour is very annoying and that probably
the problem is in the datagrid.
By

Stefano
 
I have (finally) find a workaround.

int the Closing() event of the form you MUST set the grid's datasource
to null before of hideing the form

private void QueryForm_Closing(object sender, CancelEventArgs e)
{

grid.DataSource = null; // before of Visible = false
Visible = false;
e.Cancel = true;
}

I think that there's a VERY BIG problem under the 1.1 framework
by
Stefano
 
Back
Top