T
tshad
I have a page with Trace.Warns statements in my Page_Load and functions that
it calls, but it doesn't seem to work in a class that is defined on the same
page. I am writing this in C#
I am getting the following error at the 1st Trace.Warn:
***********************************************
Compiler Error Message: CS0118: 'System.Web.UI.Page.Trace' denotes a
'property' where a 'class' was expected
Source Error:
Line 84: {
Line 85: decimal mTemp = (decimal)dAmount;
Line 86: Trace.Warn("before rounding mTemp = ");
Line 87: mTemp = Decimal.Round(mTemp,2);
Line 88: Trace.Warn("after rounding mTemp = " + mTemp + " dBalance = "
+ dBalance);
**************************************************************************
The Function is:
*************************************
// Deposit - any positive deposit is allowed
public void Deposit(double dAmount)
{
if (dAmount > 0.0)
{
decimal mTemp = (decimal)dAmount;
Trace.Warn("before rounding mTemp = ");
mTemp = Decimal.Round(mTemp,2);
Trace.Warn("after rounding mTemp = " + mTemp + " dBalance = " +
dBalance);
dBalance += (double)mTemp;
}
}
****************************************
But in my function (not part of the class other than the Page class) the
Trace works fine:
**************************************************
void OpenBankAccount()
{
// open a bank account
Trace.Warn("Create a bank account object");
BankAccount ba = new BankAccount();
ba.InitBankAccount();
*****************************************************
Why wouldn't it work in a class defined on the same page?
Thanks,
Tom
it calls, but it doesn't seem to work in a class that is defined on the same
page. I am writing this in C#
I am getting the following error at the 1st Trace.Warn:
***********************************************
Compiler Error Message: CS0118: 'System.Web.UI.Page.Trace' denotes a
'property' where a 'class' was expected
Source Error:
Line 84: {
Line 85: decimal mTemp = (decimal)dAmount;
Line 86: Trace.Warn("before rounding mTemp = ");
Line 87: mTemp = Decimal.Round(mTemp,2);
Line 88: Trace.Warn("after rounding mTemp = " + mTemp + " dBalance = "
+ dBalance);
**************************************************************************
The Function is:
*************************************
// Deposit - any positive deposit is allowed
public void Deposit(double dAmount)
{
if (dAmount > 0.0)
{
decimal mTemp = (decimal)dAmount;
Trace.Warn("before rounding mTemp = ");
mTemp = Decimal.Round(mTemp,2);
Trace.Warn("after rounding mTemp = " + mTemp + " dBalance = " +
dBalance);
dBalance += (double)mTemp;
}
}
****************************************
But in my function (not part of the class other than the Page class) the
Trace works fine:
**************************************************
void OpenBankAccount()
{
// open a bank account
Trace.Warn("Create a bank account object");
BankAccount ba = new BankAccount();
ba.InitBankAccount();
*****************************************************
Why wouldn't it work in a class defined on the same page?
Thanks,
Tom