StrataFrame Forum

Undeleting a Control

http://forum.strataframe.net/Topic17800.aspx

By Bill Cunnien - 7/11/2008

I did the unthinkable.  I deleted a grid from a form.  Crazy  The grid has been in use for quite a while and has had many changes over the last several months.  My last commitment to source control was several days ago.  Since I did not want to lose all of the work since then, and I had caught myself right away, I did the next best thing...CTRL-Z.  The grid came back.  I wiped the sweat from my brow and breathed a heavy sigh of relief.

Alas!  When I run the app (debug mode), the grid comes up "empty".  It shows that there are 31 records (count in column 1), but there is no data showing up.  I have built, rebuilt, changed the grid, built, rebuilt again.  I reset the datasource (removed the BBS, save, reset the BBS, saved again).  I am running out of ideas about why this may be happening. 

Is there a "trick" to getting an undeleted control working again?

Thanks,
Bill

By Trent L. Taylor - 7/11/2008

Is there a "trick" to getting an undeleted control working again?

Yup...source control! Crazy

It is really difficult to supply an answer without actually having the designer file and source code in hand...and even then, no guarantees!

I know that you don't need or want to hear this, but you should really be checking in your work a lot more often...for this very reason Pinch  I am a check-in junkie and check-in when I am finished with a particular segment of code.  But regardless, we always check-in everything before we shut down for the day.

By Bill Cunnien - 7/11/2008

Pinch Painful.

I reverted.  I printed everything I could, including screen shots.  I will work on getting the last three or so days updated on that one form. 

Lesson learned:  Become a source control addict.

Thanks!

By Paul Chase - 7/11/2008

Bill,

One problem you might have is that once the object gets deleted visual studio removes the handles statement and if you Ctrl Z it it does not re-apply the event handlers,

ie private sub  somethingclicked(sender as object, e as event arg) handles something.clicked

after deleted becomes somethingclicked(sender as object, e as event arg)

after Ctrl Z the handler is still misssing so your code never executes, same thing if you cut and paste an object.

By Bill Cunnien - 7/11/2008

Next time (hopefully, there will not be a next time) I will see how C# handles these handlers.  Apparently, the designer drops the definitions, then, like this one:

this.Load += new System.EventHandler(this.ProductionRequirements_Load);

Thanks,
Bill

By Keith Chisarik - 7/11/2008

I was bitten bad enough once that I have a small banner over my door that I run into every day before I leave my office, "DID YOU COMMIT TO SOURCESAFE?"

Sad , but true.

By Paul Chase - 7/11/2008

Keith Chisarik (07/11/2008)
I was bitten bad enough once that I have a small banner over my door that I run into every day before I leave my office, "DID YOU COMMIT TO SOURCESAFE?"

Sad , but true.

That's 2 funny I have a daily reminder in outlook set to go off at 12 noon and 5 :30 BigGrin The lunch time one has saved me alot of pain, sometimes I go next door to the strip club for lunch (they have a really great buffet) . And for some unknown reason I sometimes make mistakes later that afternoon and it is really nice to have my morning's work safe and secure.

By Trent L. Taylor - 7/12/2008

LOL...we all have our methods!  I have Visual Studio setup to remind me when I exit VS...you can setup an Option within Visual Studio to check things in when closing a Solution or project.  You can elect not when when it pops up, but at least it does in fact pop up as a reminder:

But Paul is also right in that the event handlers do get "smoked."  That is probably what was part of your problem...but the problem there too can be getting Humpty Dumpty back together again correctly depending on how large the program is and how many events, etc. were removed.