in

InfoPath Dev

Error Traping in VB when calling Webservice/Dataconnection

Last post 09-11-2007 03:45 PM by Greg Collins. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-24-2007 07:06 AM

    Error Traping in VB when calling Webservice/Dataconnection

    Hi  I am using Infopath2007 and VB(real rookie - but finally making headway(I hope)).

    I have a Data Connection to a webservice.  Users can enter DisplayNamePart (3chars or more), and the Webservice brings back the desired information.  All this is working well.
    BUT
    If the user enters "smi" for example there are too many records returned and an error message is displayed
    If the user enters "xyz"  there are no records and an error is displayed.
    Neither error is at all helpful to a user.


    I would like to trap these errors and help the users to put the query right. - I understand what I have got to trap is a System.Net.WebException:
    How do I do this in VB ?

    So far my code reads....

    Dim Datconcol As DataConnectionCollection = Me.DataConnections
    Dim datcon As DataConnection = Datconcol.Item("UserInfo")

    datcon.Execute()

    I have thought about looking in the Secondary DataSource to see if there are values in the fields - but this gives me another exception which I don't know how to trap.

    Thank you for your help

    Catharine

    Filed under: ,
  • 08-31-2007 04:28 PM In reply to

    Re: Error Traping in VB when calling Webservice/Dataconnection

    Have you tried using Try/Catch statements?

    Visit my Web site:

    http://www.braintrove.com

    Greg Collins / Microsoft MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 09-04-2007 08:24 AM In reply to

    Re: Error Traping in VB when calling Webservice/Dataconnection

    Thank you. - I am a real newbie to VB I had not used these before.

  • 09-11-2007 03:45 PM In reply to

    Re: Error Traping in VB when calling Webservice/Dataconnection

    Once you understand them and their true power in the world of programming, you'll be using them all the time.

    Good luck!

    Visit my Web site:

    http://www.braintrove.com

    Greg Collins / Microsoft MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (4 items)
Copyright © 2003-2007 Qdabra Software. All rights reserved.
View our Terms of Use.