Solved

vb.net - Instr question

Posted on 2010-08-12
5
413 Views
Last Modified: 2013-11-26
what does tstrx equal below?
dim tstrx as string = ""
dim strx as string = "http://shjdhncha/shgb/default.aspx"
tstrx = Mid(strx, 1 InStr(strx, "xxx") -1
0
Comment
Question by:GlobaLevel
5 Comments
 

Expert Comment

by:tyy8
ID: 33422001
This would cause an error
0
 

Expert Comment

by:tyy8
ID: 33422019
Sorry (should have added)

InStr(strx, "xxx") - 1

InStr(strx, "xxx")  is 0
InStr(strx, "xxx") - 1 is -1

There is no such point in the string as -1
0
 
LVL 27

Expert Comment

by:nmarun
ID: 33422034
0
 
LVL 16

Expert Comment

by:13598
ID: 33422107
Your length
tstrx = Mid(strx, 1, InStr(strx, "xxx") - 1)
would be 0 and you cannot have a 0 length.
It would be 0 because you are looking for 3 x in a row which don't exist in "http://shjdhncha/shgb/default.aspx"
 
What is your goal here?
0
 
LVL 17

Accepted Solution

by:
Zhaolai earned 500 total points
ID: 33422383
tstrx = Mid(strx, 1 InStr(strx, "xxx") -1
 produces two syntax errors, because it's missing a comma before InStr and missing a closing parenthesis ")" at the end.
 
 
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
API v SOA 8 42
How to share My.Settings in multiple application instances ? 7 54
How to repeat the data 4 30
VB.net VSTO Excel Ribbon error 4 14
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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