Showing a Windows Form from a Strategy
Author: svrz
Creation Date: 6/13/2008 1:36 PM
profile picture


Wealth-Lab Version 5 (.NET) 5.0


I have created a simple Windows Form with a Listview embedded on it. I would like to use this as a data grid by inserting data into it via a strategy script.

The form is created in the strategy's constructor. If the Show() method is executed in the constructor, the form is shown normally. However any additional methods that need to be called for data insertion in the Execute() method of the strategy are not executed or are not working.

When Show() is executed inside the strategy's Execute() method, the form is shown for an instant then destroyed.

Is there a guideline for using Windows Forms in WL 5.0?

I understand that this is an advanced topic but any help from the WL5 developer crew is greatly appreciated.

profile picture


<< Is there a guideline for using Windows Forms in WL 5.0? >>

Think .NET, not "Wealth-Lab". When you want a modal form, then you have to specify that.

profile picture


Thanks, Cone. ShowDialog displays the form but completely blocks WL until it is closed. Show() displays the form but soon it disappears. Showing the form in the modeless form is most desirable. I will see if somehow setting its parent to WL will achieve the desired result.

Thanks again.
profile picture


Svrz have you ever tried to create application with several windows Forms? if yes you can do same technic for WL.
If no you can use this thing:
for each form create new thread, like this:
Please log in to see this code.

in this case new form will not block WL and will work in parallel, but some times you will have problem with transfer parameters from Slave thread to WL. For resolve this problem i changed class SlaveForm:
1. add reference on masterClass (this is which you use in WL, look like - public class MasterClass: WealthScript)
in class with your Windows Form variable:
private masterClass Parent;
2. in the constructor Form:
SlaveForm(masterClass X)
{ Parent = X;
....//what ever you wish
3. For use WL function use expressions like:
you can use any WL functions but you should add "Parent." before this function.

Unfortunately, you can't create new WL workspace from this thread ... (For Cone and Eugene: it was joke)
profile picture


Eugene, Cone
I have the exact same problem with displaying forms. I need to use form.Show (form.ShowDialog blocks the originating wlp window and is not usable for me), but the form shows for an instant and then disappears. What is the best way to resolve this issue? How can I keep the form around?

-best, j

profile picture


Eugene, Cone
Do you guys have any suggestions here? I do see a solution posted by mikhmv, but it is an old posting and I am not sure if it is the best way.

-thanks, J
profile picture


Please count me out.
profile picture


No problem, thank anyway :-)
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).