By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 943 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

Visual Basic .net MSComm control

P: n/a
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.
Nov 20 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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.

http://support.microsoft.com/default...b;en-us;823179
http://www.microsoft.com/downloads/d...C-B4ED37A1578B
http://www.codeproject.com/dotnet/DotNetComPorts.asp
http://msdn.microsoft.com/msdnmag/is...netserialcomm/
http://www.htservices.com/Tools/VBan...unications.htm
Chris.
"Tico Tech" wrote:
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.

Nov 20 '05 #2

P: n/a
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/is...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" <Ch**********@discussions.microsoft.com> wrote in message
news:6A**********************************@microsof t.com...
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.
http://support.microsoft.com/default...b;en-us;823179
http://www.microsoft.com/downloads/d...C-B4ED37A1578B http://www.codeproject.com/dotnet/DotNetComPorts.asp
http://msdn.microsoft.com/msdnmag/is...netserialcomm/
http://www.htservices.com/Tools/VBan...unications.htm
Chris.
"Tico Tech" wrote:
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.

Nov 20 '05 #3

P: n/a
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.
Nov 20 '05 #4

P: n/a
Mark,

I've replied to your message in the DBComm work space. The code works fine.

Chris.

"Mark Wills" wrote:
Hi Chris,

No - i'm afraid I didn't - but I've been a bit distracted of late... I needed to know how to compile it so that I could use it in my own apps - like you would in the old days of VB6, but nobody replied :-(

Mark.
"Chris Podmore" wrote:
Hi Mark,

Good first post.
Thanks for letting us know about DBComm. Looks interesting, I'll have to download it and have a look when I get some time.

I notice you had a message on the message board asking how to use the control and no one had replied. Did you work it out?

Chris.

"Mark Wills" wrote:
Hi there,

A .Net control (written in fully managed code) has been developed that closely emulates the original MSComm control.

You can download it for free from www.gotdotnet.com

Do a search for DBComm and you should find it. It works just like the original, but is written in vb.net - you can either use it as is, or, look at the guts of it to see how the author actually got access to the serial ports and then roll your own version. Hope this helps. (this is my first post in this newsgroup!)

Regards

Mark Wills
"Tico Tech" wrote:

> 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.
>
>
>

Nov 20 '05 #5

P: n/a
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.

"Tico Tech" <ap*********@hotmail.com> wrote in message news:29XNc.60$Bb.39@lakeread08...
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.

Nov 20 '05 #6

P: n/a
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.

"Tico Tech" <ap*********@hotmail.com> wrote in message news:29XNc.60$Bb.39@lakeread08...
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.

Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.