Button3.Enabled = False Dim c As Integer c = DataGridView1.RowCount - 1 Dim r As Integer = 0 Dim pducodes() As String Dim pduL As Integer Dim pduStr As String Dim Number As String If smsEngine.IsOpen = False Then smsEngine.Open() End If PBar1.Minimum = r PBar1.Maximum = c smsEngine.Write("AT" & vbCrLf) txtR.SelectedText = smsEngine.ReadLine & vbCrLf smsEngine.DiscardInBuffer() smsEngine.Write("AT+CMGF=0" & vbCrLf) 'txtR.SelectedText = smsEngine.ReadLine & vbCrLf smsEngine.DiscardInBuffer() Label1.Visible = True Do PBar1.Value = r + 1 Label1.Text = "Sending Message: " & r + 1 & "/" & c Number = DataGridView1.Item(0, r).Value DataGridView1.Rows(r).Selected = True If RdEng.Checked Then pducodes = GetPDU("+923189244444", Number, ENUM_TP_DCS.DefaultAlphabet, ENUM_TP_VALID_PERIOD.OneDay, 0, False, TextBox1.Text) Else pducodes = GetPDU("+923189244444", Number, ENUM_TP_DCS.UCS2, ENUM_TP_VALID_PERIOD.OneDay, 0, False, TextBox1.Text) End If pduStr = pducodes(0) pduL = (pducodes(0).Length - 14) / 2 - 1 Application.DoEvents() smsEngine.Write("AT+CMGS=" & pduL & vbCr) txtR.SelectedText = smsEngine.ReadLine & vbCrLf Thread.Sleep(100) smsEngine.DiscardInBuffer() ' Do smsEngine.Write(pduStr & Chr(26)) txtR.SelectedText = smsEngine.ReadLine & vbCrLf Thread.Sleep(200) Application.DoEvents() ' Loop While (InStr(smsEngine.ReadLine, "OK")) smsEngine.DiscardInBuffer() DataGridView1.Rows(r).Selected = False r = r + 1 ' Thread.Sleep(2000) DataGridView1.Update() Loop While r < c smsEngine.Close()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)