Public Class Form1

    Sub ChangePic(ByVal index As Short)
        Dim path As String = My.Computer.FileSystem.CurrentDirectory
        Select Case index
            Case 1 : PictureBox1.Load(path + "\1.jpg")
            Case 2 : PictureBox1.Load(path + "\2.jpg")
            Case 3 : PictureBox1.Load(path + "\3.jpg")
            Case 4 : PictureBox1.Load(path + "\4.jpg")
        End Select
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim day As String = ""
        Select Case Weekday(Today)
            Case 1 : day = " 星期日"
            Case 2 : day = " 星期一"
            Case 3 : day = " 星期二"
            Case 4 : day = " 星期三"
            Case 5 : day = " 星期四"
            Case 6 : day = " 星期五"
            Case 7 : day = " 星期六"
        End Select
        TextBox1.Text = Today() & day
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        '設定所要儲存的檔案類型為文字檔案*.txt
        SaveFileDialog1.Filter = "文字檔案(*.txt)|*.txt"
        '判斷使用者是否在儲存檔案交談窗中按下儲存鈕
        If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            Dim filename As String = SaveFileDialog1.FileName
            '將RichTextBox1中的內容寫入至檔案中
            My.Computer.FileSystem.WriteAllText(filename, RichTextBox1.Text, False)
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        '設定所要開啟的檔案類型為文字檔案*.txt
        OpenFileDialog1.Filter = "文字檔案(*.txt)|*.txt"
        '判斷使用者是否在開啟舊檔交談窗中按下開啟鈕
        If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            Dim filename As String = OpenFileDialog1.FileName
            '讀取檔案並將讀取到的內容設定給RichTextBox1
            RichTextBox1.Text = My.Computer.FileSystem.ReadAllText(filename)
        End If
    End Sub

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        If RadioButton1.Checked = True Then ChangePic(1)
    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        If RadioButton2.Checked = True Then ChangePic(2)
    End Sub

    Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
        If RadioButton3.Checked = True Then ChangePic(3)
    End Sub

    Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
        If RadioButton4.Checked = True Then ChangePic(4)
    End Sub
End Class
