Wednesday, October 6, 2010

notes

Immediate window
X = 6
? X
6 {Integer}
    Integer: 6
Y = ""
? Y
"" {String}
    String: ""
? Y.Length
0 {Integer}
    Integer: 0
Y = "hello"
? Y
"hello" {String}
    String: "hello"
Y.ToUpper()
? Y
"hello" {String}
    String: "hello"
Z = Y.ToUpper()
? Z
"HELLO" {String}
    String: "HELLO"
? Y.ToUpper()
"HELLO" {String}
    String: "HELLO"
Y = "WORLD"
? Y
"WORLD" {String}
    String: "WORLD"
? Y.ToLower()
"world" {String}
    String: "world"
Y = "               Hello                         World"
The expression could not be evaluated because a build error occurred.Build Failed. For a list of build errors see the Error List. For detailed information about a build error select an item and press F1.
Y = "               Hello                         World"
? Y
"               Hello                         World" {String}
    String: "               Hello                         World"
Y = Y.Trim()
? Y
"Hello                         World" {String}
    String: "Hello                         World"


HW: String section
questions 24 - 36
questions 42 - 50
evens


book assumes option strict is on

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim result As String
        Dim t As Double = 6.75471
        result = FormatCurrency(t)
        Debug.Print(result)
        ' $6.75
    End Sub

result = FormatNumber(t, 2)

if you want to read up on Style for Format, read this article:
http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(MICROSOFT.VISUALBASIC.STRINGS.FORMAT);k(TargetFrameworkMoniker-%22.NETFRAMEWORK,VERSION%3dV4.0%22);k(DevLang-VB)&rd=true

String.Format is different from just regular Format!

Formatting Output with Zones
WWWWW
iiiii

Dim fmtStr As String = "{0, 15}{1, 10}{2, 8}"

No comments:

Post a Comment