Solved

vb.net - Instr question

Posted on 2010-08-12
5
402 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now