Discussion of article "Developing graphical interfaces based on .Net Framework and C# (part 2): Additional graphical elements"
Everything is fine, the article, GUI and endless possibilities of C#, but why no tables, Vasily? Are there any difficulties with them?
The volume of material is too large, and tables in C# are a very complicated element. It's like a triple jump. You need to accelerate by implementing basic elements and then try a complex table.
The amount of material is too large, and tables in C# are a very complex element. It's like a triple jump. You need to accelerate by implementing the basic elements, and then take a swing at a complex table.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Не удается найти указанный файл. (Exception from HRESULT: 0x80070002)
at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)
at MtGuiController.GuiController.GetGuiController(String assembly_path, String form_name)
at MtGuiController.GuiController.ShowForm(String assembly_path, String form_name)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Wrapper.Wrapper.Call(MethodInfo method, Int64 owner, Int64 parameters, Int64 result)
.Net runtime error
Error when launching the Expert Advisor from the article.
Error when running the Expert Advisor from the article.
The paths to the programme file are absolute, so you need to change them to the actual paths. It is not possible to make universal catalogues as in MT.
The paths to the programme file are absolute, so you need to change them to actual paths. It is not possible to make universal catalogues as in MT.
string assembly = "c:\\Users\\Bazil\\source\\repos\\DemoForm\\DemoForm\\bin\\Debug\\DemoForm.exe";
I have not found this file anywhere. It is not possible to compile it from the provided C#-sources yet.
I have not found this file anywhere. I can't compile it from the provided C#-sources yet.
Strange, I guess I forgot to attach it to the archive. I will post it in a few hours.
Attached in the archive
Thanks, it worked.
// I put DemoForm.exe into Libraries string assembly = TerminalInfoString(TERMINAL_PATH) + "\\MQL5\\Libraries\\DemoForm.exe";
I found a very serious error of working with C#-windows. If you move C#-window continuously, Terminal disappears from the screen after a few seconds, and the CPU-core load of terminal64.exe exceeds 100%. I have 8 cores, so the full core load in TaskManager at CPU is 12-13%. When the C#-window is moving, it is 19%.
I have a CPU in-built graphics card, no video card. I thought that the problem is in the display. That's why I ran such a test advisor
int handle = INVALID_HANDLE; void OnInit() { if (EventSetTimer(1)) handle = FileOpen(__FILE__, FILE_WRITE | FILE_TXT); } void OnDeinit( const int ) { if (handle != INVALID_HANDLE) FileClose(handle); } void OnTimer() { if (handle != INVALID_HANDLE) FileWriteString(handle, (string)TimeCurrent() + "\n"); }
It writes the time from the Market Watch every second. This is what it recorded when it moved the C#-window.
2019.06.11 16:22:09 2019.06.11 16:22:11 2019.06.11 16:22:11 2019.06.11 16:22:19 2019.06.11 16:22:23 2019.06.11 16:22:24 2019.06.11 16:22:26 2019.06.11 16:22:28 2019.06.11 16:22:31 2019.06.11 16:22:33 2019.06.11 16:22:34 2019.06.11 16:22:36 2019.06.11 16:22:37 2019.06.11 16:22:45 2019.06.11 16:22:45 2019.06.11 16:22:48 2019.06.11 16:22:51 2019.06.11 16:23:07 2019.06.11 16:23:08 2019.06.11 16:23:10
You can clearly see that OnTimer was not executed for several seconds. I.e. moving the C#-window causes the execution of Expert Advisors in the Terminal to stop.
This problem concerns not only the C#-window from this article.
Removing GuiControllerElementsDemo manually through the Terminal menu causes a few seconds of freezing.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article Developing graphical interfaces based on .Net Framework and C# (part 2): Additional graphical elements has been published:
The article is a follow-up of the previous publication "Developing graphical interfaces for Expert Advisors and indicators based on .Net Framework and C#". It introduces new graphical elements for creating graphical interfaces.
Starting with the second version, the controller supports message boxes. This is a standard user information element. It also offers users several options and receives a response in the form of a selected option.
To launch demonstration of message windows, select the 'Buttons and MessageBox' option in the Windows Form Element Type parameter when launching the EA. After launching the EA, a form appears prompting to choose one of the options:
Fig. 3. Sample form calling message boxes
This form, as well as all subsequent ones, is a demonstration one, therefore it is not equipped with trade logic. However, after pressing any of the buttons, the EA sends a warning message requesting confirmation of selected actions. For example, the following message window is displayed when clicking SELL:
Fig. 4. Trading EA requests confirmation to open a new short position
Author: Vasiliy Sokolov