Link to home
Start Free TrialLog in
Avatar of ict-torquilclark
ict-torquilclark

asked on

Argument 'Start' must be greater than zero.

I am using the following code in some VB.Net

XmlSearch = Strings.Mid(strXml, InStr(strXml, "<exweb_varied varied_name=""Term"">"))

getting an error

Argument 'Start' must be greater than zero.

I have copied the text from the strXml into a notepad document and ctr;+f'd <exweb_varied varied_name="Term"> and it finds it.

what am i doing wrong?
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Can you post a snippet of the source XML you are using?
Avatar of ict-torquilclark
ict-torquilclark

ASKER

t><amount currency="GBP">0.13</amount></payment></commission_entitlement><tpsdata><exweb_varied varied_name="Sum Assured"><original_value>50000</original_value><new_value>50000</new_value></exweb_varied><exweb_varied varied_name="Term"><original_value>15</original_value><new_value>15</new_value></exweb_varied></tpsdata></client_specific_illustration><tpsdata><exchange_formid></exchange_formid><exchange_extranet_available>False</exchange_extranet_available><print_types_available>99</print_types_available></tpsdata></product></application></m_content></message></transaction></m_content></message>
<message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.origoservices.com"><m_control><control_timestamp>2010-12-06T09:16:33.0253</control_timestamp><message_id>306f443f-61e5-4c39-a8ef-8f3a6c15a3df</message_id><retry_number>0</retry_number><message_type>Remote Publishing Alert</message_type><message_version>/origo/2.1/RPAlert.xsd</message_version><expected_response_type>none</expected_response_type><initiator_id>Exchange, The</initiator_id><initiator_orchestration_id>338763_010995_91_GL</initiator_orchestration_id><responder_id>LPDirect</responder_id></m_control><m_content><alert_action>Add</alert_action><target_environment>Live</target_environment><transaction originator_ID="AEGON Scottish Equitable"><message xmlns="http://www.origoservices.com" schemaLocation="http://www.origoservices.com/Schema/3_2/QNBProtectionQuoteResponse.xsd"><m_control><control_timestamp>2010-12-06T09:16:19.0000</control_timestamp><message_id>ce6710dd-9471-41c2-ac5f-
073a093ceac7</message_id><retry_number>0</retry_number><message_type>Quotation Response</message_type><message_version>/origo/3.2/QNBProtectionQuoteResponse.xsd</message_version><message_status>Success</message_status><response_location>TQ-Quotes-Web-Service~B8D30C30</response_location><initiator_id>LPDirect</initiator_id><initiator_orchestration_id>219_302176_6292056</initiator_orchestration_id><user_id>LPD001 LPD002</user_id><responder_id>Exchange, The</responder_id></m_control><m_content><b_control><service_provider_reference_number>338763</service_provider_reference_number><intermediary_case_reference_number>010120609162165</intermediary_case_reference_number><quote_type>Comparison</quote_type><quote_or_print>Quote Only</quote_or_print><generic_quote_ind>No</generic_quote_ind><message_version_number>3.2</message_version_number><submission_date>2010-12-06</submission_date><quote_response_status>Warning</quote_response_status></b_control><intermediary type="IFA"><sib_number>150427</sib_number><company_name>L
ife Policies Direct</company_name><branch_name>Life Policies Direct</branch_name><agency_address><postcode>WV3 0TZ</postcode></agency_address><contact_details><name>LPD001</name></contact_details></intermediary><application><personal_client id="pc1"><title>Mr</title><forenames>Lewis</forenames><surname>Turner</surname><sex>Male</sex><date_of_birth>1989-04-11</date_of_birth><tax_rate>20</tax_rate><smoker_ind>No</smoker_ind><preferred_life_ind>No</preferred_life_ind></personal_client><product type="Term Protection" product_code="Electronic"><product_name>Term Assurance (e)</product_name><increment_ind>No</increment_ind><benefits_required><life_assured personal_client_id="pc1" sequence_number="1"></life_assured><death_ind>Yes</death_ind><death_or_earlier_cic_ind>No</death_or_earlier_cic_ind><critical_illness_ind>No</critical_illness_ind><tpd_ind>No</tpd_ind><waiver_ind>No</waiver_ind><unemployment_ind>No</unemployment_ind></benefits_required><quote_details><reference_number></reference_number></quote_details><ris
k_benefit id="rb1" type="Life And Health"><cover_basis>
ASKER CERTIFIED SOLUTION
Avatar of Zhaolai
Zhaolai
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Dim n as integer= InStr(strXml, "<exweb_varied varied_name=""Term"">")
If n>0 Then
   XmlSearch = Strings.Mid(strXml, n)
Else
   MsgBox("Not found!")
End If