.NET 2.x Отправка SMS на мобильный телефон через USB-Modem - Visual Basic .NET
Формулировка задачи:
Где ошибка в этом коде ?
Совсем не работает?????
Решение задачи: «.NET 2.x Отправка SMS на мобильный телефон через USB-Modem»
textual
Листинг программы
Public Function decodePDU(ByVal strIn As String) Dim b As Byte = 0 Dim d = 0 Dim out = "" For n = 0 To strIn.Length - 1 Step 2 Dim tbyte As Byte = Val("&h" & strIn.Substring(n, 2)) Dim c = ((tbyte And ((1 << 7 - d) - 1)) << d) Or b b = tbyte >> (7 - d) out = out & Chr(c) d = d + 1 If (d = 7) Then out = out & Chr(b) d = 0 b = 0 End If Next Return out End Function Public Function encodePDU(ByVal strIn As String) Dim out = "" strIn = strIn + vbNullChar For n = 0 To strIn.Length - 2 Dim t = n Mod 8 + 1 If t = 8 Then Continue For Dim c = Asc(strIn.Substring(n, 1)) >> (n Mod 8) Dim oc = c Dim b = Asc(strIn.Substring(n + 1, 1)) And ((1 << t) - 1) c = (b << (8 - t)) Or c out = out & (Hex(c)).PadLeft(2, "0").ToUpper Next Return out End Function Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click TextBox5.Text = decodePDU(TextBox2.Text.Length) End Sub Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click TextBox5.Text = encodePDU(TextBox2.Text.Length) End Sub
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д