Israel

Israel

  • 1.1k
  • 1.3k
  • 174.2k

Why these code can not send SMS to multiple once ONLY to one

Apr 19 2017 6:03 PM
Hi!
I wrote these and works very well. I do write it just to send SMS. I was able to send at once only to one cellnumber. Its works.
try
{
WebClient client = new WebClient();
string to, msg;
to = lblNumberFlashMessage.Text;
msg = txtReceiveFlashMessage.Text;
string baseurl = "http://api.clickatell.com/http/sendmsg?user=xxx&password=xxx&api_id=xxx&to='" + to + "'&text='" + msg + "'";
client.OpenRead(baseurl);
MessageBox.Show("Message sent");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Then when I use these codes that allow me to pass one by one throught a label.
Curiously, after to click on the button, its send the SMS by its send only the last number.
Other codes:
Control p;
p = ((Button)sender).Parent;
p.SelectNextControl(ActiveControl, true, true, true, true);
int i = 1;
if (cbxReadNomFlashMessage.SelectedIndex < cbxReadNomFlashMessage.Items.Count - 1)
{
cbxReadNomFlashMessage.SelectedIndex = cbxReadNomFlashMessage.SelectedIndex + i;
Application.DoEvents();
i++;
int milliseconds = 2000;
Thread.Sleep(milliseconds);
-----------------------------------------------
THEN THE WHOLE IS:
private void btnSentFlashMessage_Click(object sender, EventArgs e)
{
// This module of code was wrote by Panana
Control p;
p = ((Button)sender).Parent;
p.SelectNextControl(ActiveControl, true, true, true, true);
int i = 1;
if (cbxReadNomFlashMessage.SelectedIndex < cbxReadNomFlashMessage.Items.Count - 1)
{
cbxReadNomFlashMessage.SelectedIndex = cbxReadNomFlashMessage.SelectedIndex + i;
Application.DoEvents();
i++;
int milliseconds = 2000;
Thread.Sleep(milliseconds);
//These code by me
try
{
WebClient client = new WebClient();
string to, msg;
to = lblNumberFlashMessage.Text;
msg = txtReceiveFlashMessage.Text;
string baseurl = "http://api.clickatell.com/http/sendmsg?user=xxx&password=xxx&api_id=xxx&to='" + to + "'&text='" + msg + "'";
client.OpenRead(baseurl);
MessageBox.Show("Message sent");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

Answers (7)