End Sub Error

I am pretty new to coding with Xojo and I am having trouble fixing this syntax error. I am trying to follow the book to make my motors move atm.

Sub and End Sub should not be placed into the editor, only the code. The Sub / End Sub is added automatically.

If you copy and paste from the forum or other place you can paste it without clicking within the editor and the event / method should be created for you.

Oh its cause it said to put that in an open event

You have added the event manually and then pasted it’s definition along with it’s code. What you have is effectively:

Sub Open() Handles Open
Sub Open() Handles Open
//This line with the correct name of the class
//on the window must be added in the Window1 Open Event
//**Only call this once in the program**
pi = New pigpio
Call pi. gpiolnitialise ()
pi.Handle = pi.pigpio_start (nil, nil)
End Sub
End Sub

By adding the event using the IDE you create the

Sub Open() Handles Open
End Sub

You then only need to copy and paste the contents. You can copy and paste the whole function and then click on the window and paste the whole thing in one go.

Oh! I see! That Makes a lot more sense! Thank you! So, If it says :


My timer should look like:
image

And my CheckDirection method looks like:
image

Correct?
Sorry, for the other errors I haven’t figured out how to properly install the new pigpio library, since I recently learned that the old one is no longer maintained.

Yes, if you add the event / method using the IDE then the Sub / Function and End Sub / End Function is added automatically. You then copy and paste just the contents.

You can, however, copy and paste the whole Sub by clicking on the object you want the event added to. In your CheckDirection example. If you copy the whole item (including the sub / End sub) you can click on the Window (or other object you want to add it to) and then choose paste. The method will then be created fresh and filled. Either is possible.

1 Like

Please mark the post that best explains the problem as the solution. That way others who see this in the future will know what the correct solution is.

1 Like

Thanks