Monday, March 8, 2010

read from a file
write it out to a textbox

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim sw As IO.StreamWriter
        sw = IO.File.AppendText("c:\josh\josh3.txt")
        sw.WriteLine("hello there")

        sw.Close()
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sr As IO.StreamReader
        sr = IO.File.OpenText("c:\josh\josh2.txt")
        TextBox1.Text = sr.ReadLine()
        Button1.Text = sr.ReadLine

        sr.Close()

    End Sub

3.5
60-66 even
'Each line triplet of DATA.TXT contains         DATA.TXT

70-76, even
The following steps calculate the amount of money earned in a walk-a-thon:

Wednesday, March 3, 2010

notes from class

input:
    textbox
    files
    s = inputbox("prompt")

output:
    debug.print
    listbox
    textbox
    file


format
formatcurrency
formatpercent
string.format
format string prior to outputting it

hw: 3.5: 32 - 36, even numbers

memory

some more code

Public Class Form1
    Dim x As Integer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim x, y As Single
        x = 3.1
        y = 8
        ' Debug.Print(FormatNumber(x, 2))
        Debug.Print(String.Format("Your number, {0}, is {1}. Thanks for playing. Again, that number was {0,-15}.", FormatCurrency(x, 2), y))
    End Sub

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Button1.ImageIndex = 1

    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click

        Button12.ImageIndex = Button12.Tag
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Button6.Visible = False
    End Sub
End Class

Monday, March 1, 2010

another hw:
under strings, 3.4, even #s from 34 through 40, and 44

some code from class

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sentence As String
        sentence = "The rain in Spain falls mainly on the ground"
        Dim startpos, spacepos, wordlen As Integer
        startpos = 0
        spacepos = sentence.IndexOf(" ", startpos)
        wordlen = spacepos - startpos
        Debug.Print(sentence.Substring(startpos, wordlen))

        startpos = spacepos + 1
    End Sub
End Class

Monday, February 22, 2010

assignment: computer game

make an apple fall from a tree. if you click it before it falls off screen, then you win. otherwise, you do not win.

use pictureboxes and a timer to accomplish this.

Thursday, February 18, 2010

a homework

section 3.3
17-22
29, 30