Siebel VB Language Reference > VB Language Reference >

Lset Statement

This standard VB statement copies one string to another or assigns a user-defined type variable to another.

Syntax A

Lset string = string-expression

Syntax B

Lset variable1 = variable2



A string variable or string expression to contain the copied characters


A string variable or string expression containing the string to be copied


A variable within a user-defined type to contain the copied variable


A variable containing a user-defined type to be copied


Not applicable


If string is shorter than string-expression, Lset copies the leftmost characters of string-expression into string. The number of characters copied is equal to the length of string.

If string is longer than string-expression, every character in string-expression is copied into string, filling it from left to right. Leftover characters in string are replaced with spaces.

In Syntax B, the number of characters copied is equal to the length of the shorter of variable1 and variable2.

Lset cannot be used to assign variables of different user-defined types if either contains a variant or a variable-length string.


This example puts a user's last name into the variable *c. If the name is longer than the size of lastname, then the user's name is truncated.

Sub Button_Click
   Dim lastname as String
   Dim strlast as String * 8
   lastname = "Smith"
   Lset strlast = lastname
   msgtext = "Your last name is: " & strlast
End Sub

See Also

Rset Statement

Siebel VB Language Reference