Click here to Skip to main content
15,913,773 members
Please Sign up or sign in to vote.
1.86/5 (3 votes)
See more:
I use timer to call function. but this application is stop.Please any one know how to do this tell me thanks in advance :)


C#
public void onrecivemsg()
          {
          try
              {
              objSmsMessage.FromAddress = "+2518899";
              objSmpp.WaitForSmsUpdate(3000);
              if (objSmsMessage.FromAddress == null)
                  {
                  objSmsMessage.FromAddress = "+2518899";
                  }

              for (int i = 0; i <= 30; i++)
                  {
                  objSmsMessage = objSmpp.FetchSmsUpdate();
                  toatalmsg += objSmpp.CountSmsReceived();
                  lbl_connected.Text = "Total " + Convert.ToString(toatalmsg) + " Received";
                  objSmsMessage = objSmpp.ReceiveMessage();

                  string strResult = "ReceiveMessage, result: " + objSmpp.LastError + " (" + objSmpp.GetErrorDescription(objSmpp.LastError) + ")";
                  Program.createlog("ReciverMessage:" + toatalmsg);

                  if (objSmpp.LastError == 0)
                      {

                      fromadd = objSmsMessage.FromAddress;
                      Toaddshortcode = objSmsMessage.ToAddress;
                      MessageBox.Show(fromadd);
                      MessageBox.Show(Toaddshortcode);
                      message = objSmsMessage.Body;
                      MessageBox.Show(message);
                      Thread th = new Thread(() => GetProcessResult(fromadd, message, Toaddshortcode));
                      th.IsBackground = true;
                      th.Start();
                      //GetProcessResult(fromadd, message, Toaddshortcode);
                      }
                  }
              }
          catch (Exception ex)
              {
              Program.createlog(ex.ToString());
              MessageBox.Show(ex.ToString());

              }
          }
Posted
Updated 27-May-14 22:21pm
v2
Comments
DamithSL 28-May-14 4:05am    
can you update the question with that Receivemsg() function code?
Patel Shweta 28-May-14 4:19am    
ok sure

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900