Jump to content
  • Advertisement
Sign in to follow this  
Funkymunky

C# project forgetting assigned events?

This topic is 3068 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using MS Visual C# 2008 EE. I have a pretty complex project set up. Once in awhile when I load it up, it's forgotten a bunch of the events I assigned to different objects on the forms. Things like the MouseMove handler on a picturebox, or the Click event on a button. It's annoying to have to reassign the things after I frustratedly realize why my program isn't working anymore. Is this at least a known phenomenon, or is there something else going on here?

Share this post


Link to post
Share on other sites
Advertisement
I don't know; haven't experienced it myself.

If it's happening often enough you can wire up the events in your constructor as a workaround:


class MyForm
{
public MyForm()
{
InitializeComponent();

_pictureBox.MouseMove += HandlePictureMouseMove;
}

private void HandlePictureMouseMove(object sender, MouseEventArgs e)
{
}
}



This is the approach I take to avoid having to use the designer to wire up event handlers. It's easier for me to type the code.

Share this post


Link to post
Share on other sites
You don't edit the *.Designer.cs files manually do you? Those are generally considered non-programmer-editable and doing so can confuse the designer pretty easily.

Other than that, I've never really had this problem myself... you might want to invest in source code control software (Subversion, git, etc) which could help somewhat with trying to figure out why things have changed.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!