How to execute function below every 10 second by timer ?

  • Thread starter Thread starter engahmedbarbary
  • Start date Start date
E

engahmedbarbary

Guest
Problem
I need to execute function retrieve image every 10 second by using timer control

i already put timer control on windows form but how to run and execute this function

in timer every 10 second .

meaning i need every 10 second refresh and executing function below

I work on windows form c sharp visual studio 2017 with SQL server 2012

Function below working but remaining how to using in timer and which event will be used ?

What I have tried:

public void GetMembersData()
{
string sqlGetLast = @"select isnull((select top 1 MemberCode from members order by MemberCode desc),1) ";
int MemberCode = Utilities.ObjectConverter.ConvertToInteger(DataAccess.ExecuteScalar(sqlGetLast));
string sqlImage = "select MemberImage FROM Members WHERE MemberCode =" + MemberCode + "";
if (Utilities.ObjectConverter.ConvertToString(DataAccess.ExecuteScalar(sqlImage)) != "")
{
byte[] MemberImage = (byte[])DataAccess.ExecuteScalar(sqlImage);
pictureBox1.Image = ByteArrayToImagebyMemoryStream(MemberImage);
}
}





Hide Copy Code

Continue reading...
 
Back
Top