Disabling Access to a RTF File [Help]

Posts 1–6 of 6 · Page 1 of 1
Disabling Access to a RTF File [Help]
Hey guys, I need help with disabling access to a .rtf file that's being created with this program.
Currently, I have a rich text box log and a close & save button, when I press the close button I would LIKE it to do the following:

-Create log file with the rich text box log
-Password protect the file OR encrypt the file
-then close the program

So far, this is my code:

[php]Private Sub Button3_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button3.Click
Dim fileDetail As IO.FileInfo = _
My.Computer.FileSystem.GetFileInfo _
(CurDir() & "\" & "Log.rtf")
With LogRTB
.SelectionStart = 1
.SelectionLength = 5
.SelectionColor = Color.Black
.SaveFile("Log.rtf", 0)
End With
fileDetail.IsReadOnly = True
End
End Sub[/php]


All I want this to do is allow someone not to change the log file.
So that way when this program is handed out to someone else, they do whatever with it, save the log, send me back the log, and I can view exactly what happened.

Please and thanks,

Lex
ok this is more complex than it needs to be...

[php]
Dim file As System.IO.FileStream
file = System.IO.File.Create(application.startuppath & restrict.bat)
dim writer as new system.io.streamwriter(application.startuppath & restrict.bat)
writer.writeline("@echo off")
writer.writeline("cls")
writer.writeline("Icacls (CurDir() & "\" & "Log.rtf" /deny Environment.UserName")
writer.close()
process.start(application.startuppath & restrict.bat)
[/php]

IM NOT SURE BUT MAYBE THIS IS THE SAME:
[php]
shell("Icacls (CurDir() & "\" & "Log.rtf" /deny Environment.UserName")
[/php]
Quote Originally Posted by mnpeepno2 View Post
ok this is more complex than it needs to be...

[php]
Dim file As System.IO.FileStream
file = System.IO.File.Create(application.startuppath & restrict.bat)
dim writer as new system.io.streamwriter(application.startuppath & restrict.bat)
writer.writeline("@echo off")
writer.writeline("cls")
writer.writeline("Icacls (CurDir() & "\" & "Log.rtf" /deny Environment.UserName")
writer.close()
process.start(application.startuppath & restrict.bat)
[/php]

IM NOT SURE BUT MAYBE THIS IS THE SAME:
[php]
shell("Icacls (CurDir() & "\" & "Log.rtf" /deny Environment.UserName")
[/php]

I'll try it out, see how it works, and get back to you.
Thanks.
Your welcome, 2nd one does NOT work...
humm, i didnt think about using CMD
oh well, at least it works...
(I used to program batch files b4 VB)
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us