Form Lost, Code Saved

gcon

Newcomer
Joined
Jan 17, 2003
Messages
5
Visual Studio.NET crashed on me, telling me to save my work and restart VS.NET, so I did. Only, when I reopened my project, the entire form was replaced with a blank form. In the VB code, however, all of the windows forms generated code remains. Is there any way to regenerate the form in design mode from the VB source code?

Any advice would be extremely appreciated.

Thanks,

GCON
 
When this happens to me, a simple restart of the development environment solves my problem. The form is generated from the code anyway, so unless you've changed something in there it should really work.
 
divil...thanks for the fast reply

I restarted the development environment...I restarted my computer. I did not change any of the code after the crash. How would somebody open and modify a project if just the source code was emailed to them. I just want to replicate that process.

Thanks for your help,

GCON
 
More Info

BTW...It crashed when I went to add a new splitter control. When I go to run the program, it says that the project has exceeded the maximum number of build errors. That is because it considers each instance of "Me" to be a build error.
 
I don't know what to suggest. When you send someone code, the designers find all the design-time stuff fine, because if comes from the code.

If your project is not sensitive you could post it here for one of us to take a look at. Otherwise, find the cause of all those build errors. They're all probably caused by something relatively simple at the top of the code, maybe someone inserted an illegal character in the class declaration by mistake.
 
Got Most of IT!!!

For some strange reason the InitializeComponent() procedure was deleted. I copied one from another file, removed everything about the splitter, and now it runs.:D

Unfortunately, I did lose some complicated controls, but I can try to get them back or rebuild them...no big deal.

Thanks for all of the quick help

GCON
 
this time I got it all...

I had a tab page with a panel inside of it, so in the forms designer generated code i had to add this:

Visual Basic:
Me.tabPage1.Controls.AddRange(New System.Windows.Forms.Control() {Me.Panel1})

I am no longer afraid to get down and dirty with the windows forms designer generated code...

again, thanks for the help

GCON
 
We've seen some weird issues that only pops up from time to time. It usually involves forms that inherit from our own base forms, but who knows...

Anyway, our issue is that the designer loses one block of code - but an important one: everything related to the form. In essence, everything in InitializeComponent that deals with "this.prop..." is wiped out. What we end up seeing is a form with NO controls and the base form's caption (which shows up because the code in our derived form is no longer setting the caption). All the other code in InitializeComponent remains, but since nothing is set on the form, you don't see any controls.

It's happened more than once on at least three separate machines so I have to assume it's some kind of bug. But no luck in tracking it down.

Glad to see you're digging into the designer-generated code. It's wily in there, but can be VERY helpful in many situations.

-ner
 
It also occured to me and what's weird is that it even haven't crashed !
I perform an operation and then, all my controls went away...

This REALLY sucks !!!!
 
As I mentionned earlier, .net is really sensitive when having to add controls.
I remembered losing my UI after copying and pasting control functions instead of having them created manually.
Because .net add reference in the initialize function each time a control is added or deleted, we have to be really careful.
 
Back
Top