Private Sub Form1_Load(ByVal sender As System.Object, ByVal _
e As System.EventArgs) Handles MyBase.Load
Dim txt As String = ""
' Right-aligned text.
txt &= "|" & String.Format("{0,20}", "Apple") & "|" & _
vbCrLf
txt &= "|" & String.Format("{0,20}", "Banana") & "|" & _
vbCrLf
txt &= "|" & String.Format("{0,20}", "Cherry") & "|" & _
vbCrLf
' Left-aligned text.
txt &= "|" & String.Format("{0,-20}", "Apple") & "|" & _
vbCrLf
txt &= "|" & String.Format("{0,-20}", "Banana") & "|" & _
vbCrLf
txt &= "|" & String.Format("{0,-20}", "Cherry") & "|" & _
vbCrLf
' Right-aligned dates.
txt &= "|" & String.Format("{0,20:M-d-yy}", Now) & "|" _
& vbCrLf
txt &= "|" & String.Format("{0,20:MM-dd-yy}", Now) & _
"|" & vbCrLf
txt &= "|" & String.Format("{0,20:MMM-d-yyyy}", Now) & _
"|" & vbCrLf
txt &= "|" & String.Format("{0,20:MMMM-d-yyyy}", Now) & _
"|" & vbCrLf
' Left-aligned dates.
txt &= "|" & String.Format("{0,-20:M-d-yy}", Now) & "|" _
& vbCrLf
txt &= "|" & String.Format("{0,-20:MM-dd-yy}", Now) & _
"|" & vbCrLf
txt &= "|" & String.Format("{0,-20:MMM-d-yyyy}", Now) & _
"|" & vbCrLf
txt &= "|" & String.Format("{0,-20:MMMM-d-yyyy}", Now) _
& "|" & vbCrLf
txtResults.Text = txt
txtResults.Select(0, 0)
End Sub
|