dannycool 0 Newbie Poster
Public Class Form

    Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AxMSComm1.CommPort = 2              ' Set the port number
        AxMSComm1.Settings = "9600,N,8,1"  ' Set UART parameters
        AxMSComm1.PortOpen = True

        'MSComm1.Output = Chr$(27) & Chr$(&H65)

    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim SampleText As String
        SampleText = TextBox1.Text
        AxMSComm1.Output = (SampleText) & (vbCr) 'vbcr is the symbolic constant of carriage return'\r'in the program
        'AxMSComm1.Output = vbCr  we can write in this way also.



        'AxMSComm1.Output = Chr$(27) & Chr$(&H65)

    End Sub

    Private Sub AxMSComm1_OnComm(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxMSComm1.OnComm


    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub
End Class

this pgm will send data to pic microcontroller .at first it shows output.but when i debug it in second time it shows error at
axmscomm1.portopen=true "exception from hresult: 0x800a1f45"system.runtime.interopservices.comexception"
since i m a fresher in vb6 please help in handling this exception.also i want to know how i could recieve and diplay on form the serial data from a port.please help me