Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / November 2003

Tip: Looking for answers? Try searching our database.

how can i connect serial port COM1 and COM2

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hakan OTAL - 19 Nov 2003 23:16 GMT
i use vb.net 2003 Arth. and i want to send some text to the Com PORT
How can i do this
Thanks for your help.
Thomas Scheidegger [MVP] - 20 Nov 2003 01:27 GMT
Hi Hakan

My Serial Port FAQ:

.NET 1.0/1.1 has no support for legacy ports (COM/LPT).

There are plans to add support for serial ports in a future version:
   http://groups.google.com/groups?&selm=O%23vQLn9bCHA.392%40tkmsftngp09
 "this sample is very similar to what we will be adding" :
   http://www.gotdotnet.com/community/usersamples/Default.aspx?query=SerialPort
    (note, project built with beta VS.NET, read gotdotnet comment)

  Future Directions for Visual C#
    http://msdn.microsoft.com/chats/vstudio/vstudio_032103.asp
     "We will add support for Serial ports to the framework..."

  Longhorn Preview with SerialPort class:
     http://longhorn.msdn.microsoft.com/lhsdk/ref/system.io.ports.aspx
     (should already be in Whidbey 2004)

With 1.0/1.1 you have to use PInvoke or Interop :

First understand the Win32 API as described here (C++):
  http://msdn.microsoft.com/library/en-us/dnfiles/html/msdn_serial.asp

MSDN article for .NET (mostly C#):
  http://msdn.microsoft.com/msdnmag/issues/02/10/NETSerialComm/

PInvoke samples for C#:
  http://www.gotdotnet.com/community/usersamples/Default.aspx?query=SerialPort
  http://msdn.microsoft.com/msdnmag/issues/02/10/NETSerialComm/
  http://www.gotdotnet.com/community/usersamples/Default.aspx?query=SerialStream
  http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=5a96c071-
e9e8-47c4-bb9e-5413384f0c25


or for VB.NET:
  http://support.microsoft.com/?kbid=823179
  http://msdn.microsoft.com/library/en-us/dnvssamp/html/vbcs_usingthecomportinvbnet.asp
  http://www.gotdotnet.com/community/usersamples/Default.aspx?query=rs232
  http://www.mentalis.org/classlib/class.php?id=15
  http://www.corradocavalli.cjb.net/

or you can use the "Managed Extensions for C++" and write wrappers.
   http://msdn.microsoft.com/library/en-us/vcmex/html/vcconMCOverview.asp
   http://www.gotdotnet.com/team/cplusplus/
   http://msdn.microsoft.com/library/en-us/dncscol/html/csharp12192002.asp
   on your VS.NET path:
    ...\VC7\managedextensionsspec.doc
    ...\VC7\migration_guide.doc
  MC++ Sample:
   http://www.codeproject.com/managedcpp/howtocomport.asp

or reusing the VB6 MSComm ActiveX is easy, but it has some 'problems' (license)
  http://support.microsoft.com/?kbid=318597
  http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=320
  http://ourworld.compuserve.com/homepages/richard_grier/NETCommOCX.htm

commercial:
  http://www.sax.net/dotnet/communications/
      (Community edition in : http://msdn.microsoft.com/vbasic/vbrkit/)
  http://www.winsoft.sk/ncomport.htm

for the Compact Framework (Windows CE)
  http://www.microsoft.com/downloads/details.aspx?FamilyID=206645de-63ba-4e49-b9a3
-2d3b9cef4aa5

  http://ourworld.compuserve.com/homepages/richard_grier/CFSerial.htm

for Interop, use newsgroup:
  microsoft.public.dotnet.framework.interop

Signature

Thomas Scheidegger - MVP .NET - 'NETMaster'
http://www.cetus-links.org/oo_dotnet.html - http://dnetmaster.net/

Hakan OTAL - 22 Nov 2003 21:15 GMT
Thanks Thomas...

> Hi Hakan
>
[quoted text clipped - 5 lines]
>     http://groups.google.com/groups?&selm=O%23vQLn9bCHA.392%40tkmsftngp09
>   "this sample is very similar to what we will be adding" :

http://www.gotdotnet.com/community/usersamples/Default.aspx?query=SerialPort
>      (note, project built with beta VS.NET, read gotdotnet comment)
>
[quoted text clipped - 15 lines]
>
> PInvoke samples for C#:

http://www.gotdotnet.com/community/usersamples/Default.aspx?query=SerialPort
>    http://msdn.microsoft.com/msdnmag/issues/02/10/NETSerialComm/

http://www.gotdotnet.com/community/usersamples/Default.aspx?query=SerialStream

http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=5a96c071-
e9e8-47c4-bb9e-5413384f0c25


> or for VB.NET:
>    http://support.microsoft.com/?kbid=823179

http://msdn.microsoft.com/library/en-us/dnvssamp/html/vbcs_usingthecomportinvbnet.asp
>    http://www.gotdotnet.com/community/usersamples/Default.aspx?query=rs232
>    http://www.mentalis.org/classlib/class.php?id=15
[quoted text clipped - 3 lines]
>     http://msdn.microsoft.com/library/en-us/vcmex/html/vcconMCOverview.asp
>     http://www.gotdotnet.com/team/cplusplus/

http://msdn.microsoft.com/library/en-us/dncscol/html/csharp12192002.asp
>     on your VS.NET path:
>      ...\VC7\managedextensionsspec.doc
[quoted text clipped - 13 lines]
>
> for the Compact Framework (Windows CE)

http://www.microsoft.com/downloads/details.aspx?FamilyID=206645de-63ba-4e49-b9a3
-2d3b9cef4aa5

>    http://ourworld.compuserve.com/homepages/richard_grier/CFSerial.htm
>
> for Interop, use newsgroup:
>    microsoft.public.dotnet.framework.interop

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.