Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In vb6 LEFT$(data,4) works but not in .NET

Status
Not open for further replies.

DeeRuff1

Programmer
May 17, 2005
17
US
Is there some thing I need to know about since trying to use Left$(data,4) is not working?
 
Make sure you are using the correct method from the .NET Framework. Just to test it, use:
Code:
Dim s As String = Microsoft.VisualBasic.Left(Data, 4)

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Sorry I meant to say - Now if that's not a step backwards I don't know what is!

I should read before submitting.
 
Not really. Having Left as a stand alone function was handy, but having a method that can perform left, right, and mid built into the string class is even more handy. ;)

Grats on the tmow by the way!

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Thanks Rick.

What I meant, though, was that we now have to make sure that there are enough characters.

Data.Substring(0,4)

is great, but it should work for upto 4 characters.

Data.Substring(0, Math.Min(Data.Length, 4))

is what I think is a rather retrograde step. It also explains a problem that I had a couple of months ago.
 
>>wouldn't Left(string, len) bomb out if string was shorter then len


No
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top