VbScript Left(string,int) equivalent in VB.NET?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Left('ironman',4)
Result - 'iron'

Is there anyway to excute this task in VB.NET? Currently, I am determing the
value of the 4th character, splitting on that, then grabbing the value of the
first part of the split. It works, but is really cumbersome and doesn't
account for a string with two consecutive values that are the same, but I
might want to include both of them
Example: ('neccesarry')
Result: 'necce'

I know that I can't just use Left() because that is now something to do with
image control.

I'm a .NET newbie and this would make my task much simpler.
Thanks!
 
NathanC said:
Left('ironman',4)
Result - 'iron'

Is there anyway to excute this task in VB.NET? Currently, I am determing
the
value of the 4th character, splitting on that, then grabbing the value of
the
first part of the split. It works, but is really cumbersome and doesn't
account for a string with two consecutive values that are the same, but I
might want to include both of them
Example: ('neccesarry')
Result: 'necce'

I know that I can't just use Left() because that is now something to do
with
image control.

You can still use 'Left'. In Windows Forms forms and controls you'll have
to qualify the method ('Strings.Left') because 'Left' will clash with the
control's 'Left' property.
 
Herfried,
will clash with the control's 'Left' property.

Although that your answer is correct, do I think that for obvious newbies
this can better be written as.

will clash with the 'Left' property from the form.

This message is for the OP as well of course.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top