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
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.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
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'
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks