I am trying to populate a text box by taking the first 8 characters of a string in a list box. I have heard of a left mid and right function. Does anybody know how to use these functions?

Thanks in advance :)

Recommended Answers

All 3 Replies

The substring function lets you specify a start point in the string and how many characters to take from that point. So to take the first 8 characters of a string would be:

string smallString = longString.subString(0,8)

Left and right accept the string and the number of characters to take as parameters. Mid takes the string, the start position and the number of characters to take. E.g.
Dim s As String
s = Left(s, length)
s = Mid(s, start, length)
s = Right(s, length)

>>...I have heard of a left mid and right function. Does anybody know how to use these functions?
I have heard that those are vb6- Functions and you should try to move on from those; even though they are still available for the migrating.programmers from "basic?" to use .net, .net.Functions as .Substring and/or your own Functions, can do most of the content.extract stuff, If Not more.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.