DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 8 of 8

Thread: mscomm

  1. #1
    onder Guest

    mscomm


    mscomm control for serial port communication is not available in .net
    but anyone out there who have used VB6 mscomm control in VB.net via interop?

  2. #2
    Patrick Steele [MVP] Guest

    Re: mscomm

    In article <3dc6a27a$1@tnews.web.devx.com>, oaydogan61@hotmail.com
    says...
    >
    > mscomm control for serial port communication is not available in .net
    > but anyone out there who have used VB6 mscomm control in VB.net via interop?


    This might get you started. It's C#, but has a lot of explanation:

    http://www.devhood.com/tutorials/tut...utorial_id=320

    --
    Patrick Steele
    Microsoft .NET MVP
    http://radio.weblogs.com/0110109

  3. #3
    Dick Grier Guest

    Re: mscomm

    Hi,

    By far the simplest way is to download NETComm.ocx from my homepage. It is
    free, and is designed for this express purpose.

    BTW, I have native .NET example code in my book (see below), if you want to
    go that way. There also are other .NET examples available online.
    Personally, most of these are too limited for me, but that is me.

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



  4. #4
    Dick Grier Guest

    Re: mscomm

    Hi Patrick,

    Take a look at my reply. Also, for VB types, there is online code at
    UsingtheCOMPortinVB.exe (from the VB .NET examples compiled by Mike Iem).

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



  5. #5
    onder Guest

    Re: mscomm


    Thank you for the replies.

    One question: are there any 'noticable' performance loss due to COM interop
    in VB:NET due to this mscomm.ocx usage? ( i don't know if the question makes
    sense! )

  6. #6
    Dick Grier Guest

    Re: mscomm

    Hi,

    >>

    One question: are there any 'noticeable performance loss due to COM interop
    in VB:NET due to this mscomm.ocx usage? ( i don't know if the question makes
    sense! )
    <<

    No (Interop does incur some overhead; but the effect is quite small in an
    actual app). However... There are performance issues with .NET itself.
    Most serial communications applications append data to string buffers. This
    operation is much more expensive in .NET (where strings are immutable) than
    in earlier versions of VB. The StringBuilder is not often a useful
    solution. None-the-less, even this potential problem is not often an issue.

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



  7. #7
    onder Guest

    Re: mscomm


    I always hear that VB6 string operations are very slow! it is suprising that
    VB.NET strings are slower. Why is stringbuiler not a solution?

    "**** Grier" <****_grier@msn.com> wrote:
    >Hi,
    >
    >>>

    >One question: are there any 'noticeable performance loss due to COM interop
    >in VB:NET due to this mscomm.ocx usage? ( i don't know if the question makes
    >sense! )
    ><<
    >
    >No (Interop does incur some overhead; but the effect is quite small in an
    >actual app). However... There are performance issues with .NET itself.
    >Most serial communications applications append data to string buffers.

    This
    >operation is much more expensive in .NET (where strings are immutable) than
    >in earlier versions of VB. The StringBuilder is not often a useful
    >solution. None-the-less, even this potential problem is not often an issue.
    >
    >--
    >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.
    >
    >



  8. #8
    Dick Grier Guest

    Re: mscomm

    Hi,

    You have to buffer data (somewhere) before you can use StringBuilder to
    append. Well, that buffer often will be a string, which must be created
    anyway, with the incumbent overhead. Also, StringBuilder assumes that you
    know, in advance, the maximum string lenght. This often is not known.
    All-in-all it is a pain.

    VB6 strings were not immutable. Thus, they could be appended (to) without
    incurring the overhead of creating a new string for every string append (as
    in .NET).

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




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links