Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitlePad strings on the left or right in Visual Basic .NET
DescriptionThis example shows how to use the RtlMoveMemory API function to copy part of a two-dimensional array into a one-dimensional array in Visual Basic .NET.
Keywordspad string, PadLeft, PadRight, String, format string, VB .NET
CategoriesVB.NET, Strings
 
Use the String class's PadLeft and PadRight methods to pad a string to a given length. The following code returns results similar to the following:

|    Left|
|Right   |
 
Private Sub Form1_Load(ByVal sender As System.Object, ByVal _
    e As System.EventArgs) Handles MyBase.Load
    Dim txt As String = ""
    txt &= "|" & "Left".PadLeft(8) & "|" & vbCrLf
    txt &= "|" & "Right".PadRight(8) & "|" & vbCrLf
    txtResult.Text = txt
    txtResult.Select(0, 0)
End Sub
 
 
Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated