Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

vb.net - Instr question

Posted on 2010-08-12
5
Medium Priority
?
435 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
[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
  • Learn & ask questions
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 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

618 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