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 6617
* "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******** ********@TK2MSF TNGP09.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@@m sn.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******** ********@TK2MSF TNGP09.phx.gbl. .. * "Rob Teixeira [MVP]" <RobTeixeira@@m sn.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 unhandled exception of
type 'System.Runtime.InteropServices.COMException'
occurred in axinterop.mscommlib.dll
|
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 have rights to use the
control. You have to contact the manufacturer of the
control--MS may not be the manufacturer, in the original
VB 6 docs it told you who to contact. Then you must pay
them what they are asking, some are a one time fee and...
|
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 being held by the MSComm is
not being released. I am using the SetPortOpen method.
Is there any way of releasing this memory explicitly.
Regards.
|
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. When I try to output some
text to the serial port via AxMscomm1.output = "some
text" within a code module, the compiler says that
AxMscomm1 is not defined. Can anyone tell me how I pass a
reference to the mscomm control located on one form from...
| |
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 component
mscomm32.ocx (1.1.0)
You need to install this component before you upgrade the project.
Does anyone know how to install the mscomm component.
|
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 not recognize this
statement.
Loop Until Len(Buffer) > 0
|
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,
n store the data in to one string type variable , msStr
but some time it store the Mscomminput, n some times it stores nothing, but in mscomm.input will have a GPS data,
why it is So?
|
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 from HRESULT: 0x800A1F52.
No one has been able to tell me why this isn't working. I know VB 2003 doesn't have serial control however I need to send this with the mscomm.
It will break at the line : comm1.Output = Packet(i)
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |