can I save Richtext files as a brand new file type that only my program can open (VB)

时间:2016-07-11 22:56:04

标签: vb.net file text file-type

I'm still a bit new to programming, but I'm trying to make a notepad application has a password before you can get in to the notepad part. (The login in page works mostly). However, I have two questions:

Can I make it so I when I save the program, it will save it as a document only my program can read? Because I wanted it to be password protected. However, MS word can open the text documents made from my program. I only want my program to be able to open and view what is created from that program.

Here is the code to save the current text:

Private Sub SaveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SaveToolStripMenuItem.Click
        Try
            Dim dlg As SaveFileDialog = New SaveFileDialog
            dlg.Title = "Save"
            dlg.Filter = "Rich Text Files (*.rtf)|*.rtf"
            If dlg.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
                RichTextBox1.SaveFile(dlg.FileName, RichTextBoxStreamType.RichText)
            End If
        Catch ex As Exception : End Try
    End Sub

(I copied this part of code from somewhere else)

The second question is:

I have two forms (login and loginpassed). If I pass the login I have set the login form to hide (because (Close) closes the whole program even the login passed form. and if I click the red X to close the loginpassed form, the login form is still running, how can I close the first form without closing the second form?

0 个答案:

没有答案
相关问题