Solved

Open Serial Open in VB.NET

Posted on 2004-10-02
2
1,310 Views
Last Modified: 2007-12-19
Hi,

Can anybody tell me how to I write a code Open Serial COM Port in VB.NET? I have found a sample from http://www.codeworks.it/net/VBNetRs232.htm but I dont know how to add in into my project! Can provide me more information and example from others website?

Your help is highly appreciated!

Rgds,
cathy
0
Comment
Question by:kaifong78
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
telefoniaip earned 125 total points
ID: 12213117
FOR OPEN PORT USING:

Dim MSCOM As AxMSCommLib.AxMSComm
  MSCOM._CommPort = 1
        MSCOM.Settings = "38400,N,8,1"
        MSCOM.InputLen = 0
         MSCOM.PortOpen = True
        MSCOM.Enabled = True
        Timer1.Enabled = True

For get data do you need put a TIMER:

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        Dim MSCOM As AxMSCommLib.AxMSComm
        Dim datA As Object = MSCOM.Input
        rt.Text = rt.Text & datA

IF you need get some data not all data:

     Dim MSCOM As AxMSCommLib.AxMSComm
        Dim datA As Object = MSCOM.Input
        rt.Text = rt.Text & datA

'''''' the next linea indicate if the data contain keywork Password add the result in a textbox.

        If InStr(datos, "Password:") > 0 Then
rt.Text = rt.Text & datA
                    End If

If you need send data:

 MSCOM.Output = "Hello How Are ?"
            MSCOM.Output = (vbCrLf)

comenary:
(vbCrLf) =  ENTER KEY.
             
0
 

Author Comment

by:kaifong78
ID: 12215019
Hi,

Thank you for your reply. However MSComm32.ocx is not delivered with Visual Studio, I am using VB.NET. Please take a look this URL  http://ourworld.compuserve.com/homepages/richard_grier/NETCommOCX.htm

Code is quite similar with MSCOMM

        AxNETComm1.CommPort = 1
        AxNETComm1.PortOpen = True
        AxNETComm1.RThreshold = 1
        AxNETComm1.set_Output("Hello" & vbCr)

I have sucess to sent text to our Making System via RS203 with this code.

MSCOM.Output = "Hello How Are ?"
            MSCOM.Output = (vbCrLf)

The output only display in frist line -> Hello How Are ?

Do you know how do I sent a 2nd text to 2nd line?

example output:
Hello How Are You? -> 1st line in system screen
I am fine.  -> 2nd line in system screen

I have tried WriteLine but got error! Please help. Thanks







0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question