Right and Left

S

SurturZ

You can but in a Windows Form they get shadowed by the .Left and .Right
properties of the form. It's quite annoying.

You have a few options:
1) (my preferred) Use Mid() instead
2) Type Microsoft.VisualBasic.Left("abcdef",1) instead
3) Create a function VBLeft() which calls Microsoft.VisualBasic.Left

Right() is the one you'll miss.
 
A

Armin Zingler

SurturZ said:
You can but in a Windows Form they get shadowed by the .Left and
.Right properties of the form. It's quite annoying.

You have a few options:
1) (my preferred) Use Mid() instead
2) Type Microsoft.VisualBasic.Left("abcdef",1) instead
3) Create a function VBLeft() which calls Microsoft.VisualBasic.Left

TheString.SubString(0, ...) 'however, not 100% equal
Right() is the one you'll miss.


Or use Microsoft.VisualBasic[.Strings].Right



Armin
 
F

Family Tree Mike

I believe you could do this at the top of your class:

Imports MVB = Microsoft.VisualBasic

then in your code:

a = MVB.Left("abcdef",1) 'for example
 
H

Herfried K. Wagner [MVP]

SurturZ said:
You can but in a Windows Form they get shadowed by the .Left and .Right
properties of the form. It's quite annoying.

You have a few options:
1) (my preferred) Use Mid() instead
2) Type Microsoft.VisualBasic.Left("abcdef",1) instead
3) Create a function VBLeft() which calls Microsoft.VisualBasic.Left

I simply qualify the function call with the module containing it:
'Strings.Left'.
 
C

CMoya

Herfried K. Wagner said:
I simply qualify the function call with the module containing it:
'Strings.Left'.

Wow... glad I stumbled over this post. Thank you Herfried. I've been doing
Microsoft....yada.Left() for years in WinForms modules and never really
realized the Strings.Left() option. Much more elegant! Thanks!
 

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

Top