ThinkGeo.com    |     Documentation    |     Premium Support

Odd Error TrackEnded Event

I am getting the attached error in the designer after adding the TrackEnded event.  The code compiles fine and seems to work fine but the designer no longer works.


Here is the code that I added to the designer.cs file: 

 








this.mapControl.TrackOverlay.TrackEnded += new System.EventHandler<ThinkGeo.MapSuite.DesktopEdition.TrackEndedTrackInteractiveOverlayEventArgs>(this.TrackOverlay_TrackEnded);

 Anybody have any idea what is wrong here?


Thanks.


Curtis




Curtis, 
  
 Which version is your using? And can you try to comment out the hooking up of event to see this problem will go away? 
  
 I DONOT think this event hooking up can have any impact on the designer.  
  
 Any more information would be appreciated. 
  
 Thanks. 
  
 Yale 


Hi Yale,


I am using 3.0.362 with VS 2008 and if I comment out the hooking up of the event all is fine.  But, when I uncomment again I get the same error.  I have the hooking up of the event in the *.Designer.cs file under the windows form designer generated code section.


Thanks.


Curtis



Curtis, 
  
 Thanks for your information! 
  
 So you are trying to use the e.Cancel property in this event? And Following is the error information? 
  
 ‘ThinkGeo.MapSuite.DesktopEdition.TrackEndedTrackInteractiveOverlayEventArgs.Cancel’ is obsolete: ‘This Property is obsolete and will be removed from next release, we recommend you use . The Cancel is removed for this event args. Use the TrackEnding event instead to use functionality.’  
  
 If so, that is correct, we will delete the e.Cancel property in later version package and now it is marked as obsolete information. 
  
 Let me know if any more questions. 
  
 Thanks. 
  
 Yale 


Yale, 
  
 No, that is not the case.  I did not even mention using e.Cancel in my post.  I do not want to use the TrackEnding event because everytime I stop moving the mouse the event is fired.  This is most definitely associated with the designer from what I can tell and it has something to do with the event hooking. 
  
 Any other suggestions? 
  
 Curtis

Curtis,


Thanks for your explanations.
 
We did some investigations and it seems that this problem will only happens when the event hooked up the InitializeComponent as you said.
 
This problem will go away even hooking up the event in the constructor of Form control:

public Form1()
{
    InitializeComponent();

    this.winformsMap1.TrackOverlay.TrackEnded +=new EventHandler<TrackEndedTrackInteractiveOverlayEventArgs>(TrackOverlay_TrackEnded);
}

 

While it seems controls in .net will also have similar problem, I have no idea why this occurs. If you hook up the event in the same way for DataGridView, it will also have same problem.

this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(608, 69);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.Size = new System.Drawing.Size(123, 150);
this.dataGridView1.TabIndex = 3;
this.dataGridView1.Rows.CollectionChanged += new System.ComponentModel.CollectionChangeEventHandler(Columns_CollectionChanged);

 

Any more questions feel free to let me know.
 
Thanks.
 
Yale