473,569 Members | 2,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AxMSComm

Anyone uses MSComm in .net? I try to dynamically create the MSComm, without
dragging the control to the form, but got the InvalidActiveXS tateException.

Dim cmp As AxMSCommLib.AxM SComm
cmp = New AxMSCommLib.AxM SComm
CType(Me.ScanSe rial, System.Componen tModel.ISupport Initialize).Beg inInit()
cmp.ContainingC ontrol = Me
cmp.Enabled = True
cmp.Name = "Serial"
'cmp.OcxState =
CType(Me.ScanSe rial, System.Componen tModel.ISupport Initialize).End Init()

Any idea how to solve it or what causes the problem? Is the BeginInit() and
EndInit() needed?

thanks
eugene
Nov 21 '05 #1
3 10363
Hi,

You cannot use MSComm dynamically under .NET. The COM interface
implementation requires that it be sited.

However, you can download DesktopSerialIO .dll from my homepage (syntax is
similar to that of MSComm) -- and it is free, or use the Sax Communications
Community Edition Serial Control that is part of the Microsoft Visual Basic
..NET Resource Kit (also free). There are other serial classes available
online.

One advantage to my dll (an other .NET implementations ) is that they are
standalone and don't require MSComm or the wrapper dll that .NET builds.
Another is that deployment is simple. Just copy the dll along with your
exe.

Dick

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.
Nov 21 '05 #2
thanks, so the mscomm be be contained in the form. btw, what is meant by
sited, why is it so?

"Dick Grier" wrote:
Hi,

You cannot use MSComm dynamically under .NET. The COM interface
implementation requires that it be sited.

However, you can download DesktopSerialIO .dll from my homepage (syntax is
similar to that of MSComm) -- and it is free, or use the Sax Communications
Community Edition Serial Control that is part of the Microsoft Visual Basic
..NET Resource Kit (also free). There are other serial classes available
online.

One advantage to my dll (an other .NET implementations ) is that they are
standalone and don't require MSComm or the wrapper dll that .NET builds.
Another is that deployment is simple. Just copy the dll along with your
exe.

Dick

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.

Nov 21 '05 #3
Hi,

thanks, so the mscomm be be contained in the form. btw, what is meant by
sited, why is it so?
<<

Sited means added to the form from the ToolBox (and accessed from the
STAThread for that form). Why? Because... That's the way interoperabilit y
for ActiveX controls in .NET was designed. Fighting with it is like
deciding that the Sun should come up in the West. Maybe it should, but it
doesn't.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.
Nov 21 '05 #4

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

Similar topics

0
2858
by: Terminal882003 | last post by:
Hi, Here I have a question about MSCommLib. I need to dynamically add activeX controls that requires run-time license for MSCommLib. The following is the actual code: AxMSCommLib.AxMSComm mscomm = new AxMSCommLib.AxMSComm(); string strLicense = "gfjmrfkfifkmkfffrlmmgmhmnlulkmfmqkqj";
6
6967
by: Peter Krikelis | last post by:
Hi All, I am having a problem setting up input mode for serial communications. (Sorry about the long code post). The following code is what I use to set up my comm port.
0
1735
by: VR | last post by:
I wrote a wrapper class around mscomm32.ocx in C# and I have a problem deploying it to a PC without IDE installed. I am getting an error message about the class not being licensed. I found some references to that in MS knoweldge base - they claim I need to add the license manually to the cotrol, at run time Here is what my class is like I...
18
5680
by: Itzik | last post by:
need help i Have this error in my project: "An unhandled exception of type 'System.Threading.ThreadStateException' occurred in system.windows.forms.dll Additional information: Could not instantiate ActiveX control '648a5600-2c6e-101b-82b6-000000000014' because the current thread is not in a single-threaded apartment." on this row :
0
2129
by: asam.reddy | last post by:
Hi, I am trying to read serial port using the MSComm control in VS.NET2003(referred from the VS6.0). I have the code already in VB6 which I am coding to C#.NET. After setting all the required settings of the COM1 Port Dim buffer As Variant Dim arr() As Byte
0
1590
by: shawnn | last post by:
Hello, I am able to get a list of ports using the System.Management classes. Win32_SerialPort has data members for port name, baud rate, etc, etc... but no entry for port index number. I need to map Win32_SerialPort's to indicies to set AxMSCommLib.AxMSComm.CommPort for read/write port access. How can I get a port number given a...
0
1038
by: shawnn | last post by:
Hello, I need to license AxMSCommLib.AxMSComm at runtime, I'd rather not mess with the registry at install. I have seen this code posted all over the web: AxMSCommLib.AxMSComm com; string strLicense = "kjljvjjjoquqmjjjvpqqkqmqykypoqjquoun";
0
1676
by: anirban123 | last post by:
I am basically upgrading a VB 6.0 application to C# in .NET 2.0. The VB code has used AxMsComm object to read and write to devices through serial port.I have added the Microsoft Communication Control Version 6.0 tool to my toolbox.I have sited (drag n drop) the control in my form and trying to put some data on the serial port.But...
0
4481
by: nmsreddi | last post by:
Hi friends I am working on c#.net . i am developing a windows application using c# 2003 aim of my application is sending and receiving sms using GSM modem. for this i am using AxMscomm control which is there in VB6.0(telephone device) by using this i am able to receive the data and able to send message .but the
0
7694
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
Oralloy
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. ...
0
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7964
tracyyun
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...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
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
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.