Re: Substring question

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Fniles,

Why do you not use that same instructions as in VB6 as they are there if you
are used to those. They are legal (as well in the future) in VBNet.

The most of the VB functions have something extra, like to overcome the
problem as you wrote.

Cor


"fniles" <fniles@xxxxxxxxxx> schreef in bericht
news:ezjKGxfbGHA.3840@xxxxxxxxxxxxxxxxxxxxxxx
In VB 6 I used to do like the following:
if left(str,3) = "abc" then

In VB.NET when I do the following
sStr.Substring(0, 3), and the sStr has fewer than 3 characters, it will
give me an error.

For ex: sStr = "a", if I do sStr.Substring(0, 3), it will give me an
error. So, I was forced to do

if len(sStr) >= 3 then
if sStr.Substring(0, 3)
:
Is there an easier way to to it besides the above code ?

Thanks




.



Relevant Pages

  • Re: New threads!
    ... Pat Gardiner wrote: ... > instructions to overcome the problem, ... Pure bred utility chickens and ducks ...
    (uk.business.agriculture)
  • Re: error code 80073712
    ... My HP laptop wouldn't backup for like a year, ... but after reading this site i've overcome it! ... I followed the instructions above, ...
    (microsoft.public.windowsupdate)
  • Re: How to embed a Manifest File?
    ... do not sure I understand the instructions). ... It suggests this is the method for a Visual Basic aX dll, ... did you look at the manifest example in that link. ... slightly different to the one normally sugested for vb6 exe's. ...
    (microsoft.public.vb.general.discussion)
  • Re: I REALLY Need some help
    ... If you read the instructions you will see .ep referred to ... Don't be afraid, use the Norton system and it ... The people think the Constitution protects their rights; But government sees it as an obstacle to be overcome. ...
    (microsoft.public.security.virus)
  • Re: DameWare mini remote
    ... instructions if you don't want to buy a program. ... The people think the Constitution protects their rights; But government sees it as an obstacle to be overcome. ... |> |I am running Spybot daily and it is not detecting anything. ...
    (microsoft.public.security.virus)