BrowseDialog Search freezing issue


Author
Message
Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
I added a custom browse dialog frmCustomersMaintenanceBrowseDialog and it works perfectly if I have the CustomerMaintenance form appear first, then have the user click on the BROWSE button on the Maintenance Toolbar. BUt I want the Browse Dialog to appear first so I added the following to the frmCustomersMaintenance_Load event:

private void frmCustomersMaintenance_Load(object sender, EventArgs e)

{

this.frmCustomersMaintenanceBrowseDialog.ShowDialog();

}

This does bring up the Browse Dialog first, but when the user clicks SEARCH, the screen freezes. I am not doing any out of the ordinary with the BO.

Is there something else I need to do. What might be helpful is if you code tell me how I could bring up a messagebox showing me the SELECT statement just before it is executed? Or the Connection Striing? I already read the other parts of the forum on screen freeze but they do not seem to help with the issue.

Thanks.


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
The problem is that the form has not fully loaded at this point.  When you do something like this you are always better off overrides the On method versus handling the event since you cannot control the event order.  But if you override the On method you can then control at what point your logic will be fired.  In this case, I would probably put this in the OnCreateControl method instead of the Load

Overrides Protected Sub OnCreateControl(...)
    MyBase.OnCreateControl(...)

    MyBrowse.ShowDialog()
End SUb


Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
Here is what I used:

protected override void OnCreateControl()

{

this.OnCreateControl();

frmCustomersMaintenanceBrowseDialog.ShowDialog();

}

When it runs I get a "stack overflow" on the "this.OnCreateControl()"


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
There is something else trying to manage the window handle which is causing a nesting issue since the MDI owner hasn't been fully updated yet.  This is common when using an MDIClient.  Just override the OnShown method and place your code there.  At this point the forum will be fully instantiated and belong to the MDI container...thus removing the stack overflow.
Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
This worked. Wish that the actual form would not be visible before the Search Dialog appeared. This may be something you want to change in the framework in the future to have a setting that would allow the browse dialog to appear first as an option.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
This may be something you want to change in the framework in the future to have a setting that would allow the browse dialog to appear first as an option.

Not a framework issue...it's a .NET issue.  This is because of the MDI form logic.  If you want to get around this then you can create your own MDI environment. 

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You could also overwrite the OnParentChanged method and the form will not have been shown yet....and you wouldn't have to write your own MDI environment Smile

Overrides Protected Sub OnParentChanged(...)
    MyBrowseDialog.ShowDialog()
End SUb

Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
That works 100 percent better, but when you close the CustomerMaintenance form with the red X in the top right corner, the browse dialog appears and you need to CANCEL it on the CANCEL button. If you know what needs to be twaeked to have the form close without the browse coming up, then this solution work be PERFECT for everyone wanting to do this.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
That behavior I couldn't reproduce....it worked fine when I ran it. 
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search