Using Mid Function in VB.NET


Just like VB6 Mid function, the middle section of a string can be splitted at specific points.

It works the same way as in VB6.
To show an example, let's say we have a string "Laptop Computers" stored in a variable myStr and we will use Mid function to retrieve a few letters from the string.

'--- Variable Declarations
Dim myStr As String
Dim Output as String

myStr = "Laptop Computers" '--- Store the word Spaceship into myStr
Output = Mid(myStr,4,8) '---Retrieve 8 letters starting from the 4th letters counting from left
Msgbox(Output) '--- Display a messagebox


The output from the message above will be "top Comp"

See also Left Function in VB.NET
See also Right Function in VB.NET

See also Left Function in VB6/Classic
See also Mid Function in VB6/Classic
See also Right Function in VB6/Classic

0 comments