Newbie question: Mid or Substring???

V

VicWare

Hi,

I'm quitte experienced with VB, but now I'm starting with VB.net and have a
(newbie) question about the functions to use in VB.net.

Should I use the covential functions like 'mid', 'left' etc. or should I use
the .NET functions like Substring etc.

Is there any problem in using the conventional VB language in VB.net???
Thanks for replying!

Regards,
VH
 
C

Chris, Master of All Things Insignificant

They supplied the Mid/Left and such function to make it feel more familiar
to vb developers. AFAIK all they do is call the corresponding VB.NET
functions. They made it for you to use it, so there isn't any problems.
Personally I think the .Net way is more OO way of doing things and I switch
over.

Chris
 
J

Jay B. Harlow [MVP - Outlook]

VicWare,
Should I use the covential functions like 'mid', 'left' etc. or should I
use the .NET functions like Substring etc.
Use which ever you are comfortable with. However to avoid an "Oddball
Solution" be consistent within your project on which you use.
Is there any problem in using the conventional VB language in VB.net???
Function like 'mid', 'left' etc use base 1 offsets, .NET function such as
String.Substring use base 0 offsets, mixing them within a single function
can cause subtle problems

Oddball Solution taken from Joshua Kerievsky's book "Refactoring to
Patterns" from Addison Wesley. When a problem is solved one way throughout a
system and the same problem is solved another way in the same system, one of
the solutions is the oddball or inconsistent solution.

Hope this helps
Jay
 
H

Herfried K. Wagner [MVP]

VicWare said:
I'm quitte experienced with VB, but now I'm starting with VB.net and have
a (newbie) question about the functions to use in VB.net.

Should I use the covential functions like 'mid', 'left' etc. or should I
use the .NET functions like Substring etc.

Use them, whenever using them makes sense, which means that they provide
functionality in an explicit way not provided by the .NET Framework and/or
not provided in such an obvious way VB's own functions do. Be aware of the
differences between VB's string functions which use 1-based character
positions and the 'String' class' functions which are zero-based.
Is there any problem in using the conventional VB language in VB.net???

No!
 
V

VicWare

Thanks for your replies!
I feel more comfortable now starting my first VB.net project...

Regards,
VicWare
 

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