Function to retrieve line of code

andyred

Active member
Joined
Mar 5, 2009
Messages
27
Programming Experience
1-3
Hi guys

I am looking for a function like this:

Function(Line x) must return the line x as a string (where Line x is a line of code from Form1 I specify)

Example:
Function(Line 10) returns the code (instructions) from line 10 as a string

If Line 10 from Form1 is: "if a=b+c then...."
Function(Line 10) returns "if a=b+c then...."

Any ideas?

Thanks
 
If you set "Copy To Output Directory" option for the source file in question you can simply do this:
VB.NET:
Dim lines() As String = IO.File.ReadAllLines("Form1.vb")
Dim lineNum As Integer = 11
MessageBox.Show(lines(lineNum - 1))
The option is in Properties window when you select a source file in Solution Explorer.
 
I don't want the source code to be available to the user.
I am trying to make a line checksum inside the application itself.
Any ideas?
 
The running program will need a copy of the source code for you to have a function to check a certain line.

If you're wanting to do a checksum, what you could do is create a separate app that'll do an md5 calculation on your current exe file (dll's too) and if the hash isn't what the program's looking for then someone tampered with your exe after they installed your program.
 
How do I link the dll with the exe. I know how to check in the exe for the dll checksum but how do I transmit the hash from dll back to the exe?
 
Back
Top