Closed Thread
Results 1 to 1 of 1

Thread: Loading Text Files Using MonthCalender

  1. #1
    xGhost4000x is offline Newbie
    Join Date
    Aug 2008
    Posts
    6
    Rep Power
    0

    Loading Text Files Using MonthCalender

    Hello, I am trying to use month Calender to load text files, more importantly if I click on September 25 2008 I want it to load a text file for Sep. 25, or if there is no text file for that specific date I want it to make a new one.

    I have the ability to load and save working but I can't tie them to the calender. Here is what I have:



    Save Button
    Code:
        Private Sub sve_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sve.Click
    
            Dim Save As New SaveFileDialog()
            Dim myStreamWriter As System.IO.StreamWriter
            Dim myStreamReader As System.IO.StreamReader
            myStreamReader = Nothing
            myStreamWriter = Nothing
    
            Save.Filter = "Plain Text Files (*.txt)|*.txt|All files (*.*)|*.*"
            Save.CheckPathExists = True
            Save.Title = "Save"
            Save.ShowDialog(Me)
            Try
                myStreamWriter = System.IO.File.AppendText(Save.FileName)
                myStreamWriter.Write(rtxt.Text)
                myStreamWriter.Flush()
            Catch ex As Exception
                ' Do nothing on Exception
            Finally
                If Not myStreamReader Is Nothing Then
                    myStreamWriter.Close()
                End If
            End Try
    
    
        End Sub

    Load Button
    Code:
        Private Sub lde_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lde.Click
    
            Dim Open As New OpenFileDialog()
            Dim myStreamReader As System.IO.StreamReader
            myStreamReader = Nothing
    
    
            Open.Filter = "Plain Text Files (*.txt)|*.txt|All files (*.*)|*.*"
            Open.CheckFileExists = True
            Open.Title = "Open"
            Open.ShowDialog(Me)
            Try
                Open.OpenFile()
                myStreamReader = System.IO.File.OpenText(Open.FileName)
                rtxt.Text = myStreamReader.ReadToEnd()
            Catch ex As Exception
                ' Do nothing on Exception
            Finally
                If Not myStreamReader Is Nothing Then
                    myStreamReader.Close()
                End If
            End Try
    
        End Sub
    To clarify What I want is for the program to load a text file when I click a date, I do not want it to ask me where to load from I want that determined within the code, and then I want the ability to create new text documents....the save function I currently have will do fine for that, I'll just have to make it more autonomous.

    Any help will be greatly appreciated.

    EDIT: Almost forgot, I am using VB 2008 Express.
    Last edited by xGhost4000x; 09-25-2008 at 01:06 AM. Reason: Forgot Somethin'

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Loading files/database on another site
    By Bioshox in forum PHP Development
    Replies: 2
    Last Post: 09-26-2011, 08:33 AM
  2. Replies: 3
    Last Post: 07-12-2010, 03:34 AM
  3. Loading text file from Internet
    By Blimp in forum Visual Basic Programming
    Replies: 11
    Last Post: 04-12-2010, 12:43 AM
  4. Loading files?
    By ZipOnTrousers in forum Java Help
    Replies: 7
    Last Post: 01-11-2010, 07:34 AM
  5. Differences between text files and binary files.
    By LoneWolf in forum C and C++
    Replies: 3
    Last Post: 02-24-2009, 04:36 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts