Visual Basic > Strings
Copying fixed length strings
Copying fixed length strings An example of how to parse fixed length strings using the LSet statement is given below. Description: "LSet Left aligns a string within a string variable, or copies a variable of one user-defined type to another variable of a different user-defined type" Code: Option Explicit Private Type tEmployee Name As String * 12 Age As String * 2 Department As String * 8 Grade As String * 9 End Type Private Type tBuffer Buff As String * 1024 End Type Sub LSetExample() Dim Buffer As tBuffer Dim Employee As tEmployee 'Copy the string into a buffer Buffer.Buff = "EquitiesExecutive" 'Copy the buffer into a fixed type LSet Employee = Buffer 'Output results Debug.Print "Name: " & Employee.Name Debug.Print "Department: " & Employee.Department Debug.Print "Grade: " & Employee.Grade Debug.Print "Age: " & Employee.Age End Sub
Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows