Kees created a drag & drop support of our X# email program which I pulled successfully from the git repo (we use Bitbucket). However, adding 2 event handlers (and later also removing 1) as done via the Winforms Events button in the properties of the form, did not arrive in my solution. It starts with a compiler error (unhandled event); when I manually add the event, it creates the empty event method somewhere which I than have to remove again as the original code is already present (and now accounted for).
I thought it must be something in a .gitignore file but it turned out that none exists for this solution.
Is there anything I can do to make GIT work for eventhandler-assignment ?
Dick
Event handler changes not in GIT
Re: Event handler changes not in GIT
Dick,
Git does not "know" anything about event handlers or any kind of code.
It works at the file level and compares changes between the original and the changed code.
When your event handlers are no longer there, then there was an error when merging the changed code and the original code.
Robert
Git does not "know" anything about event handlers or any kind of code.
It works at the file level and compares changes between the original and the changed code.
When your event handlers are no longer there, then there was an error when merging the changed code and the original code.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
-
mindfulvector
- Posts: 32
- Joined: Tue Jun 24, 2025 1:57 pm
- Location: United States
Re: Event handler changes not in GIT
It sounds like you may be modifying the code generated by the designer? If so, the reason your changes are reverting is not due to git, but is because the designer regenerates that generated code any time you touch the form's design. If this is the case, you will need to do one of these things:
1. Adjust your code so that it can run outside of the parts generated by the designer (such as by setting properties after the form is initialized, for example)
2. Find a way to get the designer to generate exactly what you want
3. Or stop using the designer all together and copy the generated code into a new .prg file.
This last is the route I have gone with my much more complex projects, but generally the first two options are highly preferable.
1. Adjust your code so that it can run outside of the parts generated by the designer (such as by setting properties after the form is initialized, for example)
2. Find a way to get the designer to generate exactly what you want
3. Or stop using the designer all together and copy the generated code into a new .prg file.
This last is the route I have gone with my much more complex projects, but generally the first two options are highly preferable.
Re: Event handler changes not in GIT
Many moons ago I learned, the simplest way to avoid this is good ol' inheritance. Use the designer for design work. Add another file, containing a child class of the form/server/whatever the designer produces. Use and edit only in this file.
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Re: Event handler changes not in GIT
Thanks for all comments. What I expected is that the in the .Net world we would have a 'effortless' way to exchange all changes in a program between multiple programmers. Again, this is something that doesn't work (fully). On code level it does indeed work well but it feels a bit poor that one programmer needs to send a mail to fellow programmers: note that I added this and this event handler from the designer of window x. Then the other programmer has to do the same, and delete the generated code because VS is not smart enough to see that this code is already there.
Dick
Dick
-
HansjoergP
- Posts: 174
- Joined: Mon Jul 25, 2016 3:58 pm
- Location: Italy
Re: Event handler changes not in GIT
This works fine in VS and in .Net. We have about 10 programmers who work on the same code at the same time and never really have any problems.
When making changes to a piece of code at the same time, you always have to be careful, as no version control system can predict what the entire correct code will be. In this case, you have to intervene manually during merging.
Hansjörg
When making changes to a piece of code at the same time, you always have to be careful, as no version control system can predict what the entire correct code will be. In this case, you have to intervene manually during merging.
Hansjörg
-
mindfulvector
- Posts: 32
- Joined: Tue Jun 24, 2025 1:57 pm
- Location: United States
Re: Event handler changes not in GIT
Hi Hansjörg,
If you are unable to use hosted git solutions such as github.com, or find them difficult to use, I would suggest looking into Fossil SCM. It is much simpler, and all you need to do to host it is run "fossil server" on a machine that all developers have access to (perhaps via Tailscale, etc.) I use it extensively.
* It is free, open source, and written by the same chap who wrote sqlite.
* It also includes a complete wiki, chat system, forum, and ticket system.
* Tailscale is not open source but has a free tier. This tool will make it as if all your computers are on the same network. It is a bit like the old Hamachi, but also much easier to use.
https://fossil-scm.org/home/doc/trunk/www/index.wiki
~Isaac
If you are unable to use hosted git solutions such as github.com, or find them difficult to use, I would suggest looking into Fossil SCM. It is much simpler, and all you need to do to host it is run "fossil server" on a machine that all developers have access to (perhaps via Tailscale, etc.) I use it extensively.
* It is free, open source, and written by the same chap who wrote sqlite.
* It also includes a complete wiki, chat system, forum, and ticket system.
* Tailscale is not open source but has a free tier. This tool will make it as if all your computers are on the same network. It is a bit like the old Hamachi, but also much easier to use.
https://fossil-scm.org/home/doc/trunk/www/index.wiki
~Isaac
Re: Event handler changes not in GIT
Hello , I would never trust of handling something fully electric. That's why I was doing still funny things with databases, vfp9 even there is a lot to buy and do on the market.
Using a tool with generators in between is always magic. That's why I ( DevOps Manager ) I was still on the payroll , even the dev team told me something about AI ( caramba, tacos....) . The magic on git is its working with caches . Sometimes you have to invalidate them.
So a clear sync composition structure would sometimes help. Im at a the conference next month.
Rainer
Using a tool with generators in between is always magic. That's why I ( DevOps Manager ) I was still on the payroll , even the dev team told me something about AI ( caramba, tacos....) . The magic on git is its working with caches . Sometimes you have to invalidate them.
So a clear sync composition structure would sometimes help. Im at a the conference next month.
Rainer
Re: Event handler changes not in GIT
Hello Hansjörg,
What do you do differently?
Dick
Now I am confused. We saw that changes in eventhandlers, added in the Design mode, were not 'transferred' to my system, and Robert confirms that only file changes are. But you write that it all works fine.HansjoergP wrote: Fri Jan 23, 2026 10:31 am This works fine in VS and in .Net. We have about 10 programmers who work on the same code at the same time and never really have any problems.
Hansjörg
What do you do differently?
Dick
Re: Event handler changes not in GIT
Hi Dick,
When you add evenhandlers in the designer (in VS), is like doing anything else code related, the changes are applied directly to code. So either Kees did not commit all the code changes, or you tried to merge yours and his changes and missed his code changes related to the event handlers.
When you add evenhandlers in the designer (in VS), is like doing anything else code related, the changes are applied directly to code. So either Kees did not commit all the code changes, or you tried to merge yours and his changes and missed his code changes related to the event handlers.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu

