Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
Set Timer to execute a function in c# Windows Application
Nathan R
Mar 13 2014 1:19 AM
1.6k
Reply
Sir,
I need your help.
I want to execute a function using timer at a interval of 1 hour.
Please correct this code get the function executed. Here the function:-
private void PerformTimer()
{
timer1.Start();
WebClient client = new WebClient();
string no, msg;
no = textBoxNo.Text;
msg = textBoxMSg.Text;
string baseUrl = "http://www.businesssms.co.in/sms.aspx?ID=xxxxxxx&Pwd=xxxxxxxx&PhNo=91xxxxxxxx&Text=MessageText";
Stream data = client.OpenRead(baseUrl);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
data.Close();
reader.Close();
timer1.Stop();
}
And I just called function in the onTimerEvent:-
public void OnTimerEvent(object source, EventArgs e)
{
try
{
PerformTimer();
}
catch (Exception ex)
{
MessageBox.Show(ex + "SMS02", "SMS", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
SqlException :Error converting data type nvarchar to int
how to use hirachyid in asp.net c# to view and trace tree st