what is a better way to write this, i want it to be able to read the file, then replace the text in the file.
VB Code:
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click IO.File.Delete("dtmbuffer.txt") IO.File.Copy("dtm.txt", "dtmbuffer.txt") Dim dtm As IO.StreamReader = IO.File.OpenText("dtmbuffer.txt") Dim dtm2 As IO.StreamWriter = IO.File.AppendText("dtm.txt") Try Select Case dtm.ReadLine() Case Is = 1 MsgBox("Task Manager is already disabled.") Me.Close() Case Is = 0 Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\System") Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\System", True).SetValue("disabletaskmgr", "1") dtm2.WriteLine("1") MsgBox("Task Manager is now disabled.") Me.Close() End Select Catch ex As Exception End Try End Sub




Reply With Quote