none
Save As? RRS feed

  • Question

  • Just a simple question about Save As. I want to add a save As option and a Load option that will allow you to search for the file. I think I need to do a try catch but was not sure. Here is the program I made, its pretty simple but I thought it might be useful.

     

    Imports System
    Imports System.IO
    Imports System.Drawing.Text
    Public Class Main
    
    #Region "Tool Strip Menu Items"
        Private Sub NewStickyTestToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim NewStickyTestToolStripMenuItem As New Main
            NewStickyTestToolStripMenuItem = New Main
        End Sub
    
        Private Sub NewStickyNoteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewStickyNoteToolStripMenuItem.Click
            rtbBody.Clear()
        End Sub
    
        Private Sub SaveStickyNoteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveStickyNoteToolStripMenuItem.Click
            Dim SaveStream As New System.IO.StreamWriter(CurDir() & "Stick It.fil")
            SaveStream.Write(rtbBody.Text)
            SaveStream.Close()
            SaveStream.Dispose()
            MsgBox("Save Completed")
        End Sub
    
        Private Sub OpenStickyNoteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenStickyNoteToolStripMenuItem.Click
            Dim LoadStream As New System.IO.StreamReader(CurDir() & "Stick It.fil")
            rtbBody.Text = LoadStream.ReadToEnd
            LoadStream.Close()
            LoadStream.Dispose()
            MsgBox("Load Completed")
        End Sub
    
        Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
            Application.Exit()
        End Sub
    
        Private Sub Font_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Font.Click
            Dim Fonts As New InstalledFontCollection
            For Each X As FontFamily In Fonts.Families
                Font.Items.Add(X.Name)
            Next
        End Sub
    
        Private Sub rtbBody_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rtbBody.TextChanged
            rtbBody.Font = New System.Drawing.Font(Font.SelectedItem.ToString, 10, FontStyle.Regular)
        End Sub
    #End Region
    
    #Region "Backgrounds"
        Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
            'Light Blue
            Me.BackgroundImage = My.Resources.Background
        End Sub
    
        Private Sub ToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem3.Click
            'Dark Blue
            Me.BackgroundImage = My.Resources.Background2
        End Sub
    
        Private Sub ToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem4.Click
            'Purple
            Me.BackgroundImage = My.Resources.Background3
        End Sub
    
        Private Sub ToolStripMenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem5.Click
            'Pink
            Me.BackgroundImage = My.Resources.Background4
        End Sub
    
        Private Sub ToolStripMenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem6.Click
            'Red
            Me.BackgroundImage = My.Resources.Background5
        End Sub
    
        Private Sub ToolStripMenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem7.Click
            'Orange
            Me.BackgroundImage = My.Resources.Background6
        End Sub
    
        Private Sub ToolStripMenuItem8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem8.Click
            'Yellow
            Me.BackgroundImage = My.Resources.Background7
        End Sub
    
        Private Sub ToolStripMenuItem9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem9.Click
            'Green
            Me.BackgroundImage = My.Resources.Background8
        End Sub
    #End Region
    End Class
    

     

    Tuesday, November 29, 2011 4:58 AM

Answers

  • Hi ,
     
    This forum is specifically for matters dealing with Microsoft Project.  I suggest you try to find a more appropriate forum that deals with you code problems.
     
    Mike Glen
    Project MVP (97-11)
    Tuesday, November 29, 2011 9:12 AM
    Moderator
  • mholmes_3038,

    This looks like VB code but I see no reference to anything related to Project, a planning and scheduling application. If it IS related to Project, you can try posting to the forum, http://social.msdn.microsoft.com/Forums/en-US/project2010custprog. If it is NOT related to Project, as Mike says, you need to find a more appropriate forum, perhaps one dealing with VB in general.

    John

    Tuesday, November 29, 2011 4:09 PM

All replies

  • Hi ,
     
    This forum is specifically for matters dealing with Microsoft Project.  I suggest you try to find a more appropriate forum that deals with you code problems.
     
    Mike Glen
    Project MVP (97-11)
    Tuesday, November 29, 2011 9:12 AM
    Moderator
  • mholmes_3038,

    This looks like VB code but I see no reference to anything related to Project, a planning and scheduling application. If it IS related to Project, you can try posting to the forum, http://social.msdn.microsoft.com/Forums/en-US/project2010custprog. If it is NOT related to Project, as Mike says, you need to find a more appropriate forum, perhaps one dealing with VB in general.

    John

    Tuesday, November 29, 2011 4:09 PM
  • Sorry guys/gals i remember when I was posting this my Ie started acting weird. Sorry for posting in wrong area.
    Wednesday, November 30, 2011 3:56 AM