3
Answers

Eventhandler deletion?

Ask a question
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?

Answers (3)