Solved

# vb.net - Instr question

Posted on 2010-08-12
Medium Priority
426 Views
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
Question by:GlobaLevel
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

Expert Comment

ID: 33422001
This would cause an error
0

Expert Comment

ID: 33422019

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

ID: 33422034
0

LVL 16

Expert Comment

ID: 33422107
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"

0

LVL 17

Accepted Solution

Zhaolai earned 2000 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

Question has a verified solution.

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

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
###### Suggested Courses
Course of the Month9 days, 11 hours left to enroll