I have an old code (VB6) to test port com1 which is connected with my phonecell.. i upgraded to VB.NET using upgrade wizards and my code change into like this
the projects is compiled succesfull but cannot run always fail (port is bad)
any suggestion please ?
BTW anyone has *.dll to send sms
Code:
Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
Dim buffer As String
On Error GoTo err_handler
With AxMSComm1 'oldname mscomm1
.CommPort = 1
.Settings = "57600,N,8,1"
.InputLen = 0
.PortOpen = True
End With
Dim waktu As Date
waktu = Now
Do
AxMSComm1.Output = "ATE1" & Chr(13)
Do
buffer = buffer & AxMSComm1.Input
Loop Until InStr(buffer, "OK") Or InStr(buffer, "ERROR") Or Now > DateAdd(Microsoft.VisualBasic.DateInterval.Second, 10, waktu)
Loop Until InStr(buffer, "OK") Or Now > DateAdd(Microsoft.VisualBasic.DateInterval.Second, 10, waktu)
AxMSComm1.PortOpen = False
AxMSComm1 = Nothing
If InStr(buffer, "OK") Then
MsgBox("Kondisi port OK.")'port is ok
Else
MsgBox("Port tidak dapat digunakan saatini.") 'port is bad
End If
err_handler:
If Err.Number = 8002 Or Err.Number = 8005 Then
AxMSComm1 = Nothing
End Sub
any suggestion please ?
BTW anyone has *.dll to send sms