Imports System.IO

Partial Class basiccode
    Inherits System.Web.UI.Page

    Protected Sub CheckBoxList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBoxList1.SelectedIndexChanged
        Dim img As Image
        Dim descr As String = ""
        Dim item As ListItem

        For Each item In Me.CheckBoxList1.Items
            If item.Selected = True Then
                descr = descr & item.Text & " information displayed<br/>"
                Me.Literal1.Text = descr

                img = New Image()
                img.ImageUrl = "./Images/" & item.Value
                Me.PlaceHolder1.Controls.Add(img)
            End If
        Next
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim textFile As TextReader
        Dim text As String
        Dim html As String = ""

        textFile = New StreamReader("C:/Documents and Settings/Mike/My Documents/Visual Studio 2005/WebSites/WebSite1/sometext.txt")

        text = textFile.ReadLine()
        Do While Not text Is Nothing
            html = html & text & "<br/>"
            text = textFile.ReadLine()
        Loop

        Me.Literal2.Text = html

        textFile.Close()
        textFile.Dispose()

    End Sub

    Protected Sub AddTextButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles AddTextButton.Click
        Dim textFile As TextWriter
        Dim text As String

        textFile = New StreamWriter("C:/Documents and Settings/Mike/My Documents/Visual Studio 2005/WebSites/WebSite1/sometext.txt", True)

        text = Me.TextBox1.Text
        textFile.WriteLine(text)

        textFile.Close()
        textFile.Dispose()

    End Sub
End Class
