.NET Forms in v3.10
I am trying to create an Addon that uses .NET forms. I am running B1 8.81 PL04 and v3.10 of the framework. When I create a new form and call form.LoadToSap() the frame shows but none of the contained controls are present. It appears InitializeComponent is not being called (in debug mode within Visual Studio I set a breakpoint within the method and it never gets reached).
I have built the sample COR_DotNetForms from Samples_SAP88 and it works as-is. However this appears to be built against the .NET 2.0 framework and use older versions of the 4 reference SAP and SWA DLLs. If I copy MyForm to may VS project I get the same behavior. Also, if I update the sample project to .NET 3.5 and update the project references to the newer DLLs the sample exhibits the same behavior I am seeing in my application.
Are there known issues with the framework v3.10 and .NET forms? I haven't been able to find anything specific in either these forums or the release notes posted.
I've included my class definition below. The calling code is:
[color=#2b91af]TestForm[/color] testForm = [color=blue]new[/color] [color=#2b91af]TestForm[/color]();
Any insight and/or suggestions would be greatly appreciated.
[color=blue]public[/color] [color=blue]partial[/color] [color=blue]class[/color] [color=#2b91af]TestForm[/color] : [color=#2b91af]SAPDotNetForm[/color]
[color=blue]public[/color] TestForm() : [color=blue]base[/color]([color=blue]true[/color], [color=#a31515]"TestForm"[/color], SwissAddonFramework.Utils.[color=#2b91af]UniqueStringGenerator[/color].Next())
[color=blue]protected[/color] [color=blue]override[/color] [color=#2b91af]Rectangle[/color] GetInitialDimensions()
[color=blue]return[/color] [color=blue]new[/color] [color=#2b91af]Rectangle[/color](50, 50, 400, 300);
[color=blue]protected[/color] [color=blue]override[/color] [color=blue]void[/color] InitComponents()
[color=blue]private[/color] [color=blue]void[/color] button1_Click([color=blue]object[/color] sender, [color=#2b91af]EventArgs[/color] e)
are you compiling in x86 mode?
If not this might be the cause.
Furthermore, before calling the base.InitComponents() add a Dock like:
this.Dock = System.Windows.Form.DockStyle.Fill;
I have the same problem.
Completely blank screen
Anders OlssonHi Geoff,
In the InitComponents() method you must call InitializeComponent().
In your example you are calling InitComponents() recursively.