Click here to Skip to main content
15,889,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My code as follows
C#
private void SendBulkSMS()
      {

          string template;
          try
          {
              int iRow;
              for (iRow = 0; iRow < dataGridView1.RowCount; iRow++)
              {
                  if (dataGridView1[0, iRow].Value != DBNull.Value && dataGridView1[0, iRow].Value != null && dataGridView1[0, iRow].Value != null && dataGridView1[0, iRow].Value.ToString() != "0")
                  {
                        template = SendSMS(dataGridView1[0, iRow].Value.ToString());
                  }
              }

          }
          catch (Exception ex1)
          {
              MessageBox.Show(ex1.ToString(), "Error", MessageBoxButtons.OK);
              return;
          }
      }

when i run above code shows error message as follows
cannot implicity convert type void to string.

the error line shows as follows;
C#
template = SendSMS(dataGridView1[0, iRow].Value.ToString());


please help me.

for that how can i do in asp.ent using c#.
Posted
v2

1 solution

Presumably SendSMS() does not return a value, so you should be using it like this:
C#
if (dataGridView1[0, iRow].Value != DBNull.Value && dataGridView1[0, iRow].Value != null && dataGridView1[0, iRow].Value != null && dataGridView1[0, iRow].Value.ToString() != "0")
{
   SendSMS(dataGridView1[0, iRow].Value.ToString());
}
 
Share this answer
 

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