what have they done to the left function

  • Thread starter Thread starter gonzosez
  • Start date Start date
G

gonzosez

I need to get the first 40 places of a given string.
Left(rsVMFG("comments").Value, 40)

produces an error

The error says Left() as integer
 
Hi Gonzo,

VB.Net assumes that you want to set the x-coordinate of a control in
pixels. Use Strings.Left instead and you get what you want.

Best Regards,

HKSHK
 
I never knew about the Strings module in the VB namespaces and I've been
working in .Net for 5 years. Shows how much is out there to know.

FWIW, .Left is a wrapper for System.String.Substring. Since Substring will
throw an exception if the parameters are outside of the range of the input
value (ie. you want substring(10) on a string that is only 5 characters long),
they check the length and if the requested length is longer than the actual
input value, it just returns the input value. Easy enough to do on your own,
but .Left sure seems quicker. Yet another example of how VB can be more productive
than some other languages....

Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
 
Hallo Jim,
I never knew about the Strings module in the VB namespaces and I've been
working in .Net for 5 years. Shows how much is out there to know.

the "Strings" module also existed in classic VB, but I would expect
that nobody ever needed to know that... ;-)

Best Regards,

HKSHK
 
Back
Top