I'm programming with Visual Studio 2010, my code for a listview is.
this.FolderBox.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.Folders});
this.FolderBox.Location = new System.Drawing.Point(3, 78);
this.FolderBox.MultiSelect = false;
this.FolderBox.Name = "FolderBox";
this.FolderBox.Size = new System.Drawing.Size(216, 225);
this.FolderBox.TabIndex = 7;
this.FolderBox.UseCompatibleStateImageBehavior = false;
this.FolderBox.View = System.Windows.Forms.View.Details;
this.FolderBox.DoubleClick += FolderBox_DoubleClick;
this.FolderBox.ItemSelectionChanged += FolderBox_ItemSelectionChanged;
this.FolderBox.KeyDown += FolderBox_KeyDown;
But everytime I run my program and stop it, it reverts to.
this.FolderBox.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.Folders});
this.FolderBox.Location = new System.Drawing.Point(3, 78);
this.FolderBox.MultiSelect = false;
this.FolderBox.Name = "FolderBox";
this.FolderBox.Size = new System.Drawing.Size(216, 225);
this.FolderBox.TabIndex = 7;
this.FolderBox.UseCompatibleStateImageBehavior = false;
this.FolderBox.View = System.Windows.Forms.View.Details;
The last few lines are deleted, and I can't figure out why. Anyone know why this happens? More importantly, how do I stop it? I looked it up a bit and it seems to be a flaw with VS, can anyone confirm?
Loading
Charles MorissettePosted May 25, 2011, 4:32 PM
This was causing it to delete those lines every 2nd execution of my code from debug, for whatever reason. I figured that out when I was trying to click/press enter and nothing was happening, then I looked at the designer window and noticed 0 code.
I added that and now it works fine.
Sam HobbsPosted May 25, 2011, 3:54 PM
My guess is that you have two instances of the object. That is just a guess but it is a common beginner mistake.
Posted May 25, 2011, 2:50 PM
http://msdn.microsoft.com/en-us/vstudio/aa718359
Do you have the same issue in other machines also? If so, download the latest version of vs 2010 from Microsoft.
Hope this helps you.