我想做用vb.net一个电子日记的软件,现在的打开保存功能是实现了,不过感觉有点不合适。保存功能代码:
  Private Sub MenuItembaocun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItembaocun.Click
        Dim s As String, name As String
        Static count As Integer = 1
        Dim message, title As String
        Dim style As MsgBoxStyle
        If txttitle.Text = "" Then
            message = "请输入日记标题"
            title = "错误"
            MsgBox(message, MsgBoxStyle.OKOnly, title)
        Else
            name = txttitle.Text & count & ".txt"
            s = Application.StartupPath() + "\" & txttitle.Text & count & ".txt"
            count = count + 1
            RichTextBox1.SaveFile(s, RichTextBoxStreamType.PlainText)
            message = "保存成功!!"
            title = "保存文件"
            style = MsgBoxStyle.OKOnly
        MsgBox(message, style, title)
        End If
    End Sub
这样可以保存到我指定的路径下。
打开功能代码是:
  Private Sub MenuItemopen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemopen.Click
        If Me.OpenFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
            Dim MyFileName As String = Me.OpenFileDialog1.FileName
            Me.RichTextBox1.LoadFile(MyFileName, RichTextBoxStreamType.PlainText)
            Me.OpenFileDialog1.Filter = "*.txt|*.txt"
        End If
    End Sub
虽然没有错误,但我觉得不合适,日记软件肯定写的日记是要保密的,这样,只要别人知道你保存的地方,就可以看到
你写的内容,而且打开还必须要使用者知道自己保存哪里了,不然找不到,打开,可以打开电脑上的所有txt文件。
这样的功能不能满足日记软件的要求。不能实现内容的保密,要看以前写的日记也比较麻烦。
我想实现像qq空间那样,可以打开的话可以列出以前写的日记的纪录,选择然后打开。或者打开的话,使用者只能看到自己以前写的日记,不会电脑里面所有txt文件都看到,保存的文件别人不能在“我的电脑”路径下找到,实现加密。
找了好多,都不知道怎么办,希望各位能帮帮我,谢谢!

 
											





