473,386 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

MSCOMM.OCX and Exception from HRESULT: 0x800A1F52

hi everbody

i am using visual basic 2005. i am write a modem control program and
get callerID value. i am send a AT command to modem.
Dim mscomm1 As New MSCommLib.MSComm

mscomm1.CommPort = 3
mscomm1.PortOpen = True
mscomm1.Output = "AT#CID=1"
mscomm1.Output = "AT%CCID=1"
mscomm1.Output = "AT+VCID=1"
mscomm1.Output = "AT#CC1"
mscomm1.Output = "AT*ID1"

every command return OK or ERROR.

Sub KontrolEt()
'control telephone line
Try
Dim m As String
Dim r As String = TextBox1.Text

m = r.Substring(123, 1)
If m = "0" Then
r = r.Substring(123, 11)
GoTo there
End If

If m = "0" Then

Timer1.Enabled = False
Me.BarButtonItem17.Enabled = True
mscomm1.PortOpen = False

TextBox1.Text = ""
MsgBox("no number")
frmMusteriSec.Show()
Else
r = r.Substring(123, 7)
End If
there:

Timer1.Enabled = False
mscomm1.PortOpen = False

TextBox1.Text = ""

frmSiparisAl.FormShow(1, "", m)

Catch ex As Exception

End Try
End Sub

telephone ring and my program error code : Exception from HRESULT:
0x800A1F52. what is this code. but this code run vb.net 2003 and no
problem

Mar 21 '06 #1
1 7436
Hi,

You should be using the System.IO.Ports namespace, not MSComm.

However, your code will not work for several reasons (which will be true for
MSComm or System.IO.Ports).

1. You must terminate each command to the modem with a carriage return
(vbCr). For example:
mscomm1.Output = "AT#CID=1" & vbCr

2. You MUST wait between commands to the modem, sufficient time for the
modem to process THAT command and to return a result -- the easiest way is
to call a function that looks for that specific modem response (often "OK" &
vbCrLf). If you do not wait, the modem with "ERROR".

The CID results will be available (with appropriate code) via the OnComm
event. You enable OnComm receive events by setting mscomm.RThreshold = 1.
Remember to set RTSEnable = True, also.
--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004.
See www.hardandsoftware.net for details and contact information.
Mar 22 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: RSB | last post by:
Hi Every one, i am using the try Catch block.. and the Exception object has a Message Property but i want to Catch the Error Number so that based on the Error number i can display Different error...
0
by: BizWorld | last post by:
I am using a com component in my web application. when i call a method of com component. it gives the following error only ComException HRESULT: 0xC0000005 If i run this com component in VB 6...
1
by: Peter Krikelis | last post by:
Hi, I am trying to develope a User Control Library that features MScomm control. I test my user control in a test application. When I run the application I receive the following: An...
3
by: Lekyan | last post by:
I have problem setting the password for an ADAM user using C#. I used the SetPassword code given in the Microsoft page, changed several parameters, but ran into an exception. I wonder if other...
1
by: caid | last post by:
Hi there. I'm writing a C# app (in VS.NET 2003) that sends a binary sms using MSComm. I got it going with a gsm modem, but ideally we want to use a cellphone as the sending device. However, when...
2
by: sgr | last post by:
Hello I'm making an application that uses an excel worksheet, My problem appears when I open the worksheet to see the data (then I close it and save the changes) and I try to insert a new row from...
0
by: cmdolcet69 | last post by:
I get the following error message when I output to the mscomm: An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in COM.exe Additional information: Exception...
1
by: AAAA84 | last post by:
I have program in VB 6 that used MSComm. I have upgraded it in VB.NET 2005. However. when i execute the program, i get an Exception from HRESULT: 0x800A1F52. I am using AT commands. I have looked...
4
by: fergc | last post by:
Hi.. I'm learning visual basic, so I installed the Visual Studio 2008 Express Edition to do the school projects, but when I try to look at the properties of my project I can't.. this is what...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.