I am using an activex control mscomm to control a serial
port in VB.NET. I place the control on the main form and
set its port, baud rate, etc. properties. After creating
a code module that needs to access the serial port, I
cannot seem to be able to access the mscomm control from
within a code module. In VB6 you could use the statement
frmMain.Mscomm1.output = "some data string" in the code
module but this won't work in VB.NET. Does anyone know
the correct syntax to send data to an mscomm activex
control located on a form from a code module?
Thanks for any help,
Barry 6 6535
* "Barry Martin" <bm*******@att.net> scripsit: I am using an activex control mscomm to control a serial port in VB.NET. I place the control on the main form and set its port, baud rate, etc. properties. After creating a code module that needs to access the serial port, I cannot seem to be able to access the mscomm control from within a code module. In VB6 you could use the statement frmMain.Mscomm1.output = "some data string" in the code module but this won't work in VB.NET. Does anyone know the correct syntax to send data to an mscomm activex control located on a form from a code module?
You need a reference to the control. Default instances of forms are
gone, that's why the code won't work. You will have to pass a reference
to the control to the module, for example in a public property of the
module or the parameter of a method defined in the module.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Default instances will be back in the next version of VB.NET.
Not sure whether I really like that or not yet.
-Rob Teixeira [MVP]
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... * "Barry Martin" <bm*******@att.net> scripsit: I am using an activex control mscomm to control a serial port in VB.NET. I place the control on the main form and set its port, baud rate, etc. properties. After creating a code module that needs to access the serial port, I cannot seem to be able to access the mscomm control from within a code module. In VB6 you could use the statement frmMain.Mscomm1.output = "some data string" in the code module but this won't work in VB.NET. Does anyone know the correct syntax to send data to an mscomm activex control located on a form from a code module?
You need a reference to the control. Default instances of forms are gone, that's why the code won't work. You will have to pass a reference to the control to the module, for example in a public property of the module or the parameter of a method defined in the module.
-- Herfried K. Wagner [MVP] <http://www.mvps.org/dotnet>
* "Rob Teixeira [MVP]" <RobTeixeira@@msn.com> scripsit: Default instances will be back in the next version of VB.NET. Not sure whether I really like that or not yet.
I am very happy about that... but it should be an "optional" feature.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Hi,
This works fine. Just add the control to the Toolbox (use browse from
Customize Toolbox/COM components. Then, drop MSComm on your form. The IDE
will then create the wrapper DLLs that are required. After than, using
MSComm is quite like its use under VB6.
I have examples in my book, if you are interested (see below).
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.
I certainly do agree with that.
-Rob Teixeira [MVP]
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... * "Rob Teixeira [MVP]" <RobTeixeira@@msn.com> scripsit: Default instances will be back in the next version of VB.NET. Not sure whether I really like that or not yet.
I am very happy about that... but it should be an "optional" feature.
-- Herfried K. Wagner [MVP] <http://www.mvps.org/dotnet>
Hi Dick,
Thanks for the detailed info. I will definitely check out
your book.
Thanks again
Barry -----Original Message----- Hi,
This works fine. Just add the control to the Toolbox
(use browse fromCustomize Toolbox/COM components. Then, drop MSComm on
your form. The IDEwill then create the wrapper DLLs that are required.
After than, usingMSComm is quite like its use under VB6.
I have examples in my book, if you are interested (see
below). Dick -- Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial
Communications, 3rdEdition ISBN 1-890422-27-4 (391 pages) published
February 2002.
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: jinoy |
last post by:
how can i detect an incoming caller's telephone keystroke using modem,
using mscomm or other?
how can i detect an outgoing call using mscomm?
how can i get a caller id using mscomm?
|
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...
|
by: morgal |
last post by:
That is one reason I quit using MS custom controls, you
have to buy the license. In VB 6 they give you a try it
license and then you develop a huge application or small
one and find out you don't...
|
by: AA |
last post by:
Hi
I am developing an app in which I have used a MSComm object. I have opened
the
port, performed the transactions, and then closed the port.
But when I check in the task mamager, the memory...
|
by: Barry |
last post by:
I am using the mscomm activex control in vb.net. I can
add the control to the toolbar which will allow me to
drop it onto a form. As long as I am in the code space
for that form it works fine....
|
by: Carl Gilbert |
last post by:
Hi
I'm trying to open a vb6 project in vb.net which uses the mscomm component.
When running the vb upgrade wizard in vb.net, an error is raised:
Upgrade failed, unable to load reerenced...
|
by: Tico Tech |
last post by:
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...
|
by: swati2106 |
last post by:
HI,
I have develop a apllication , To store the GPS data in database, for that , to read GPS data I have used the Mscomm port,
In which I create the object of class RS232
n open that port,...
|
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...
|
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...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |