mcapone888
Member
- Joined
- Jun 17, 2011
- Messages
- 10
- Programming Experience
- Beginner
Hi everyone. I am not a programmer. I have researched my issue online, and it seems many of the solutions are over my head. I took a few VB courses in college, but that was back 1996. I hope someone out there could help me with a 'dumbed down' solution.
I have your typical VB.Net app which writes public variables to a flat text file. It also loads them the next time the app is executed. The functionality works great, but the data is right there in plain sight. Anyone can open the .txt file and change the values.
I know there could always be someone out there determined enough to access data you do not want them to, but I am not trying to secure government secrets. But at the same time, I would like some level of protection on this data so you could not simply open up the .txt file and simply change the data.
Is there an easy way to encrypt the values before saving, and then decrypt them when loading? I believe I messed around with PHP a while back and I would use MD5 (is that right?) when inserting a password to the database. Is there something that easy in .Net?
Here is my code. I know it is bad. Like I said, I am not a programmer. I am just trying to write some practice tests for my son and store his scores in a text file so I can view them later. Maybe there is something I can add in front of the WriteLines and ReadLines? Thanks for any advice:
I have your typical VB.Net app which writes public variables to a flat text file. It also loads them the next time the app is executed. The functionality works great, but the data is right there in plain sight. Anyone can open the .txt file and change the values.
I know there could always be someone out there determined enough to access data you do not want them to, but I am not trying to secure government secrets. But at the same time, I would like some level of protection on this data so you could not simply open up the .txt file and simply change the data.
Is there an easy way to encrypt the values before saving, and then decrypt them when loading? I believe I messed around with PHP a while back and I would use MD5 (is that right?) when inserting a password to the database. Is there something that easy in .Net?
Here is my code. I know it is bad. Like I said, I am not a programmer. I am just trying to write some practice tests for my son and store his scores in a text file so I can view them later. Maybe there is something I can add in front of the WriteLines and ReadLines? Thanks for any advice:
VB.NET:
Module SaveData
Public Sub Save()
Dim FILE_NAME As String
FILE_NAME = "data\data.txt"
If System.IO.File.Exists(FILE_NAME) = True Then
Dim objWriter As New System.IO.StreamWriter(FILE_NAME)
objWriter.WriteLine(Test1)
objWriter.WriteLine(Grade1)
objWriter.Close()
Else
MsgBox("File Does Not Exist")
End If
End Sub
End Module
Module LoadData
Public Sub Load()
Dim FILE_NAME As String
FILE_NAME = "data\data.txt"
If System.IO.File.Exists(FILE_NAME) = True Then
Dim objReader As New System.IO.StreamReader(FILE_NAME)
Test1 = objReader.ReadLine
Grade1 = objReader.ReadLine
objReader.Close()
Else
MsgBox("File Does Not Exist")
End If
End Sub
End Module
Last edited: