X
xzzy
I need to update the .Text of a label until the user logs out.
but get this error:
Error: Method name expected
I have listed the code below and the offending line of code is delimited by
//The next line breaks: Error: Method name expected
Thank you,
John Bickmore
++++++++++++++++++++++++++++++++++++++++
In code behind of footer.aspx
A. Parameters:
1. ctlLabel is an <asp:Label
2. SessionStartTime is the System.DateTime.Now of when the viewer
logged in
B. In Footer.aspx.cs, the thread is created with:
fFooter myFooter = new fFooter();
myFooter.Update(ctlLabel,SessionStartTime);
++++++++++++++++++++++++++++++++++++++++
using System;
using System.Threading;
namespace fFooter
{
/// <summary>
/// Summary Called from Footer.aspx.cs to update the footer with
/// Summary the time in minutes the viewer has been logged in.
/// </summary>
public class fFooter
{
public Thread myThread;
//Parameter(s)
System.DateTime xSessionStartTime;
public void Update(System.Web.UI.WebControls.Label yLabel, System.DateTime
ySessionStartTime)
{
xSessionStartTime = ySessionStartTime;
//The next line breaks: Error: Method name expected
myThread=new Thread(new ThreadStart(UpdateLabel(yLabel)));
//The line above breaks: Error: Method name expected
myThread.Start();
}
private void UpdateLabel(System.Web.UI.WebControls.Label yLabel)
{
while ( true )
{
yLabel.Text = tTime(xSessionStartTime);
Thread.Sleep(1000);
}
}
private string tTime(System.DateTime xSessionStartTime)
{
string xx = "Active for: ";
System.DateTime dtBdate = xSessionStartTime;
System.DateTime dtToday = System.DateTime.Now;
System.TimeSpan tsTotal = dtBdate - dtToday;
decimal xDECIMAL = Convert.ToDecimal(tsTotal.TotalMinutes * -1);
int xINT = Convert.ToInt32(decimal.Round(xDECIMAL,0));
if (xINT < 1 )
{
return "Just logged in";
}
else
{
if (xINT == 1)
{
return xx + "1 minute";
}
else
{
return xx + xINT + " minutes";
}
}
}//end of method: tTime
}//end of class: Footer
}//end of Namespace: clsFooter
but get this error:
Error: Method name expected
I have listed the code below and the offending line of code is delimited by
//The next line breaks: Error: Method name expected
Thank you,
John Bickmore
++++++++++++++++++++++++++++++++++++++++
In code behind of footer.aspx
A. Parameters:
1. ctlLabel is an <asp:Label
2. SessionStartTime is the System.DateTime.Now of when the viewer
logged in
B. In Footer.aspx.cs, the thread is created with:
fFooter myFooter = new fFooter();
myFooter.Update(ctlLabel,SessionStartTime);
++++++++++++++++++++++++++++++++++++++++
using System;
using System.Threading;
namespace fFooter
{
/// <summary>
/// Summary Called from Footer.aspx.cs to update the footer with
/// Summary the time in minutes the viewer has been logged in.
/// </summary>
public class fFooter
{
public Thread myThread;
//Parameter(s)
System.DateTime xSessionStartTime;
public void Update(System.Web.UI.WebControls.Label yLabel, System.DateTime
ySessionStartTime)
{
xSessionStartTime = ySessionStartTime;
//The next line breaks: Error: Method name expected
myThread=new Thread(new ThreadStart(UpdateLabel(yLabel)));
//The line above breaks: Error: Method name expected
myThread.Start();
}
private void UpdateLabel(System.Web.UI.WebControls.Label yLabel)
{
while ( true )
{
yLabel.Text = tTime(xSessionStartTime);
Thread.Sleep(1000);
}
}
private string tTime(System.DateTime xSessionStartTime)
{
string xx = "Active for: ";
System.DateTime dtBdate = xSessionStartTime;
System.DateTime dtToday = System.DateTime.Now;
System.TimeSpan tsTotal = dtBdate - dtToday;
decimal xDECIMAL = Convert.ToDecimal(tsTotal.TotalMinutes * -1);
int xINT = Convert.ToInt32(decimal.Round(xDECIMAL,0));
if (xINT < 1 )
{
return "Just logged in";
}
else
{
if (xINT == 1)
{
return xx + "1 minute";
}
else
{
return xx + xINT + " minutes";
}
}
}//end of method: tTime
}//end of class: Footer
}//end of Namespace: clsFooter