Visual Basic .net MSComm control

  • Thread starter Thread starter Tico Tech
  • Start date Start date
T

Tico Tech

Hi:
I have a question about the Microsoft Communications Control Version 6.0
from visual studio .net.
I have this code:

Dim Buffer As String
Do
Buffer = AxMSComm1.Input() //Error, it does not recognize this
statement.
Loop Until Len(Buffer) > 0
AxMSComm1.PortOpen = False

Could someone tell me why I get this error or where I can find information
on using this ActiveX control. I went to the MSDN website but could not find
any information about this control. The MSDN site only referred me to MSComm
from visual basic 6.0.

Thanks.
 
Further to this response ...

HTS recommends Corrado Cavallis's web pages, as I too have been pointing
people to for some time. However, there is a major flaw in the code there,
which Corrado is aware of, and is correcting, I believe.

In the meantime, if you use his code - which is otherwise a very good place
to start - I suggest you refer to the article below

http://msdn.microsoft.com/msdnmag/issues/02/10/netserialcomm/

and pay particular attention to the section that describes marshalling of
the overlapped structures. This is very important, and could save you a lot
of heartache when your application mysteriously crashes without so much as a
'by your leave'.

Although I read it at the same time as I came across Corrado's page, I did
not give it my fullest attention, and spent several weeks debugging random
crashes.

HTH

Charles


Chris Podmore said:
Do you really need to use the ActiveX control? Personally I wouldn't for
..NET, I've used it with VB6 and yes it works fine but for VB.NET I would
look at other methods. May be one of the following links will help.
 
Hi,

I have a number of examples in my book (see below). Without seeing more of
your code, I cannot be sure what you are doing wrong. You can download
NETComm.ocx from my homepage, which comes with a working example that may
clear things up.

As others have mentioned, there are .NET classes and components available,
that do not rely on an AX control. I provide one in my book, and there are
others available. There is a nice component from Sax Software that is in
the Visual Basic . NET Resource Kit (a free download from Microsoft, or
available for about $5 shipping on a CD-ROM).

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
 
Found the solution! No need beat around the bushes...with HTS

Dim Buffer As String
' Wait for data to come back to the serial port.
Do
Buffer = CStr(Me.AxMSComm1.Input())
Loop Until Len(Buffer) > 0
'Display data or do something with it
Me.Text1.Text = Buffer
'Close Port
Me.AxMSComm1.PortOpen = False

Thanks anyway guys.
 
Back
Top