RE: SheetChange event crashes using Range.set_value (C#)

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi

Do you mean call the TAG function in the SheetChange event?
Based on my test, I can not reproduce the problem.
Here is my test code.
public String TAG(Excel.Range range)
{
String result = "";
try
{
result = "banana apple";
//comment the following line out to make it work
result += range.Value2.ToString();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("Bugger2!\n"
+ ex.ToString(), "Localization Function");

result = "ERROR!";
}
return result;
}

bool bChanged = false;
void exApp_SheetChange(object Sh,
Microsoft.Office.Interop.Excel.Range Target)
{
if( bChanged )
return;
try
{
bChanged = true;
TAG(Target);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
finally
{
bChanged = false;
}
}

You may have a try.
If you still have any concern, can you build a simple reproduce sample and
send the whole solution to me via removing "online" from my email address.
So that I can reproduce the problem at my side.
Thanks for your efforts.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

.


Quantcast