Page 1 of 1
WinForm button click event generated code missing RETURN
Posted: Tue Apr 30, 2019 7:54 pm
by Jamal
Create a form, add a button, double click, the double button, it creates:
Code: Select all
PRIVATE METHOD button1_Click(sender AS OBJECT, e AS System.EventArgs) AS VOID STRICT
The RETURN statement is missing.
It may not be necessary but it's not conforming the VO standard or other designer generated code which include a RETURN statement or the Start function which includes it:
Code: Select all
FUNCTION Start() AS VOID
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault( FALSE )
Application.Run( Form1{} )
RETURN
Edit: Using VS 2017
WinForm button click event generated code missing RETURN
Posted: Tue Apr 30, 2019 7:59 pm
by FFF
Jamal,
i take it, this is VS?
just did it in Xide, got:
METHOD Button1Click(sender AS System.Object , e AS System.EventArgs) AS VOID
RETURN
Karl
WinForm button click event generated code missing RETURN
Posted: Tue Apr 30, 2019 8:17 pm
by Jamal
Karl,
Yes, I should have mentioned that I use VS 2017..
WinForm button click event generated code missing RETURN
Posted: Tue Apr 30, 2019 8:18 pm
by robert
Jamal,
When the windows forms editor generates the event, it does not generate source code but an object model that describes the code.
The editor does not include a return statement. You should see that also in C# the generated code does not end with a return statement. But C# of course use curly braces so it is clear where the method ends.
This object model is the same as the object model that we generate when parsing the source code for forms.
I will see if we can detect that an event handler is generated from the forms editor and if we can then add the RETURN statement at the end of this code.
Robert
WinForm button click event generated code missing RETURN
Posted: Tue Apr 30, 2019 8:27 pm
by Jamal
Robert,
I know about the C# braces thingy but that's how C# always behaved, however, if this a new feature of X# not to require that is good but there is no indication where the code ends.
I will see if we can detect that an event handler is generated from the forms editor and if we can then add the RETURN statement at the end of this code.
I think that would be better for the sake of consistency.
Jamal