VB.Net 2005 comms problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tym

    #1

    VB.Net 2005 comms problem

    Not sure this is the right group - but here goes.

    I kinda expect Dick Grier to jump in on this one ;-)

    I've got a windows app in VB.Net 2005 which sends and receives text messages
    via a USM GSM modem. THe app cycles to poll the modem for incoming SMS as
    well as pausing this cycle to send...

    Working absolutely fine... except....

    After a given period of time, the app "looses" the GSM modem, and gets stuck
    on the .write command when I'm trying my AT+CSQ command. If I re-run the app
    it says the device isn't working properly.

    BUT

    I've I go to control panel, Phone and modem options, Modems - right click -
    properties - diagnostics and query the modem - all is well. After this, my
    app sees the modem fina again.

    I'm using the serialport1 control and talking to com13 in this isntance.

    How can I keep the port alive? what is happening?

    Secondly, I have connected an olf moble phone the the PC via a cable. This
    puts it on COM14. I can query this in hyperterminal by selecting the port
    and
    issuing AT+CSQ, and getting a response. However, if I try it in my ap -
    COM14 doesn't respond? What's the difference between Hyperterminal talking
    to the port and VB.Net?? My VB6 app can send and receive to this port (or so
    it seems to - sending AT+CMGF=1 results in an error code - in VB.NET it
    doesn't give a response at all. However, with exactly the same code, VB.NET
    does
    responde to the USB on COM13 -

    Tym



  • Dick Grier

    #2
    Re: VB.Net 2005 comms problem

    Hi,

    Sorry, I don't have a specific answer for you. However, I do have a
    suggestion. Download DesktopSerialIO .dll (the VS2005 version) from my web
    site and port your code to use it -- the syntax is slightly different, but
    similar enough that it should take only a few minutes of work (OnComm
    instead of DataReceived, Output instead of Write, and InputString instead of
    ReadExisting). Give this a try.

    I have found that the SerialPort object in VS2005 can be problematic with
    Virtual Serial ports for USB devices -- but my dll seems to be "OK" with
    them. Microsoft is aware of the issues that I have seen, though the only
    time I've seen a problem is if the physical device connection is lost, then
    re-established.

    Anyway, let me know what you find.

    Dick

    --
    Richard Grier, MVP
    Hard & Software
    Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
    Edition,
    ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
    2006.
    See www.hardandsoftware.net for details and contact information.


    Comment

    • Tym

      #3
      Re: VB.Net 2005 comms problem

      Thaks Dick,

      I had considered using the mscom32.ocx from my vb6... I presume this will do
      the same thing? -

      On your site now.. will report back as soon as I can

      Thanks

      Tym.


      "Dick Grier" <dick_grierNOSP AM@.msn.comwrot e in message
      news:uZyJsVcsHH A.4572@TK2MSFTN GP02.phx.gbl...
      Hi,
      >
      Sorry, I don't have a specific answer for you. However, I do have a
      suggestion. Download DesktopSerialIO .dll (the VS2005 version) from my web
      site and port your code to use it -- the syntax is slightly different, but
      similar enough that it should take only a few minutes of work (OnComm
      instead of DataReceived, Output instead of Write, and InputString instead
      of ReadExisting). Give this a try.
      >
      I have found that the SerialPort object in VS2005 can be problematic with
      Virtual Serial ports for USB devices -- but my dll seems to be "OK" with
      them. Microsoft is aware of the issues that I have seen, though the only
      time I've seen a problem is if the physical device connection is lost,
      then re-established.
      >
      Anyway, let me know what you find.
      >
      Dick
      >
      --
      Richard Grier, MVP
      Hard & Software
      Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
      Edition,
      ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
      2006.
      See www.hardandsoftware.net for details and contact information.
      >

      Comment

      • Tym

        #4
        Re: VB.Net 2005 comms problem

        Dick,

        Thanks for the dll and although it "works" there is a serious problem. When
        I reload my project, my main form, in which your code is utilised comes up
        with :

        at System.IO.Path. NormalizePathFa st(String path, Boolean fullCheck)
        at System.IO.Path. GetFullPathInte rnal(String path)
        at System.Reflecti on.AssemblyName .GetAssemblyNam e(String assemblyFile)
        at
        Microsoft.Visua lStudio.Design. VSTypeResolutio nService.AddPro jectDependencie s(Project
        project)
        at
        Microsoft.Visua lStudio.Design. VSTypeResolutio nService.Assemb lyEntry.get_Ass embly()
        at
        Microsoft.Visua lStudio.Design. VSTypeResolutio nService.Assemb lyEntry.Search( String
        fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly,
        String description)
        at
        Microsoft.Visua lStudio.Design. VSTypeResolutio nService.Search ProjectEntries( AssemblyName
        assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly)
        at
        Microsoft.Visua lStudio.Design. VSTypeResolutio nService.Search Entries(Assembl yName
        assemblyName, String typeName, Boolean ignoreCase, Assembly& assembly,
        ReferenceType refType)
        at Microsoft.Visua lStudio.Design. VSTypeResolutio nService.GetTyp e(String
        typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType refType)
        at
        Microsoft.Visua lStudio.Design. Serialization.C odeDom.Aggregat eTypeResolution Service.GetType (String
        name, Boolean throwOnError, Boolean ignoreCase)
        at
        Microsoft.Visua lStudio.Design. Serialization.C odeDom.Aggregat eTypeResolution Service.GetType (String
        name, Boolean throwOnError)
        at
        System.Componen tModel.Design.S erialization.Co deDomSerializer Base.GetType(IT ypeResolutionSe rvice
        trs, String name, Dictionary`2 names)
        at
        System.Componen tModel.Design.S erialization.Co deDomSerializer Base.FillStatem entTable(IDesig nerSerializatio nManager
        manager, IDictionary table, Dictionary`2 names, CodeStatementCo llection
        statements, String className)
        at
        System.Componen tModel.Design.S erialization.Ty peCodeDomSerial izer.Deserializ e(IDesignerSeri alizationManage r
        manager, CodeTypeDeclara tion declaration)
        at
        System.Componen tModel.Design.S erialization.Co deDomDesignerLo ader.PerformLoa d(IDesignerSeri alizationManage r
        manager)
        at
        Microsoft.Visua lStudio.Design. Serialization.C odeDom.VSCodeDo mDesignerLoader .PerformLoad(ID esignerSerializ ationManager
        serializationMa nager)
        at
        Microsoft.Visua lStudio.Design. Serialization.C odeDom.VSCodeDo mDesignerLoader .DeferredLoadHa ndler.Microsoft .VisualStudio.T extManager.Inte rop.IVsTextBuff erDataEvents.On LoadCompleted(I nt32
        fReload)

        in the designer.

        If I close ths, view the code, comment out the line:
        Private WithEvents SerialPort1 As New DesktopSerialIO .SerialIO.Seria lPort

        or change it to

        Public WithEvents SerialPort1 As New DesktopSerialIO .SerialIO.Seria lPort

        I can then view the designer. If I put the line back to what it was, it is
        still ok. The project builds fine, and builds the deployment ok - also
        deploys fine, but I'm confused as to why this "error" occurs?



        Tym


        "Dick Grier" <dick_grierNOSP AM@.msn.comwrot e in message
        news:uZyJsVcsHH A.4572@TK2MSFTN GP02.phx.gbl...
        Hi,
        >
        Sorry, I don't have a specific answer for you. However, I do have a
        suggestion. Download DesktopSerialIO .dll (the VS2005 version) from my web
        site and port your code to use it -- the syntax is slightly different, but
        similar enough that it should take only a few minutes of work (OnComm
        instead of DataReceived, Output instead of Write, and InputString instead
        of ReadExisting). Give this a try.
        >
        I have found that the SerialPort object in VS2005 can be problematic with
        Virtual Serial ports for USB devices -- but my dll seems to be "OK" with
        them. Microsoft is aware of the issues that I have seen, though the only
        time I've seen a problem is if the physical device connection is lost,
        then re-established.
        >
        Anyway, let me know what you find.
        >
        Dick
        >
        --
        Richard Grier, MVP
        Hard & Software
        Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
        Edition,
        ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
        2006.
        See www.hardandsoftware.net for details and contact information.
        >

        Comment

        • Dick Grier

          #5
          Re: VB.Net 2005 comms problem

          Hi,

          I have never seen this error. I have no idea what it means, sorry.

          BTW, yes, you can use MSComm32.ocx (there are licensing issues, and there is
          a KB article that addresses them -- this is the reason that I make my
          NETComm.ocx wrapper available). Deployment is a pain with MSComm, so I
          suggest that you use either my DesktopSerial dll, or stick with the
          SerialPort object, if practical.

          Dick

          --
          Richard Grier, MVP
          Hard & Software
          Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
          Edition,
          ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
          2006.
          See www.hardandsoftware.net for details and contact information.


          Comment

          • Tym

            #6
            Re: VB.Net 2005 comms problem

            Dick,

            I copied the app to antoher dirctory to make alterations for a "light"
            version and don't get the error!!

            Ho hum!!

            Thanks for the DLL - I'll use that - seems to work great for me other than
            the "glitch" which I can work with.

            Tym


            "Dick Grier" <dick_grierNOSP AM@.msn.comwrot e in message
            news:u$M8gypsHH A.1408@TK2MSFTN GP06.phx.gbl...
            Hi,
            >
            I have never seen this error. I have no idea what it means, sorry.
            >
            BTW, yes, you can use MSComm32.ocx (there are licensing issues, and there
            is a KB article that addresses them -- this is the reason that I make my
            NETComm.ocx wrapper available). Deployment is a pain with MSComm, so I
            suggest that you use either my DesktopSerial dll, or stick with the
            SerialPort object, if practical.
            >
            Dick
            >
            --
            Richard Grier, MVP
            Hard & Software
            Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
            Edition,
            ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
            2006.
            See www.hardandsoftware.net for details and contact information.
            >

            Comment

            Working...