Having your form display it's own code?

  • Thread starter Thread starter CSharp-Jay
  • Start date Start date
C

CSharp-Jay

I am currently working on building a programmer resume. The resume is
going to include a series of forms that walk the user through the
resume, showing off my coding abilities as they go. I was thinking it
would be pretty nifty as well to also have perhaps a read only text
box at the bottom of each form where they can view the actual code for
that form. The problem is I can't really think of how to get started
with that, anybody have any ideas?
 
I am currently working on building a programmer resume.  The resume is
going to include a series of forms that walk the user through the
resume, showing off my coding abilities as they go.  I was thinking it
would be pretty nifty as well to also have perhaps a read only text
box at the bottom of each form where they can view the actual code for
that form.  The problem is I can't really think of how to get started
with that, anybody have any ideas?

You know actually on first though I could write a StreamReader process
that prints everything from the code file the code textbox.
 
I am currently working on building a programmer resume. The resume is
going to include a series of forms that walk the user through the
resume, showing off my coding abilities as they go. I was thinking it
would be pretty nifty as well to also have perhaps a read only text
box at the bottom of each form where they can view the actual code for
that form. The problem is I can't really think of how to get started
with that, anybody have any ideas?

If you get a job with this, does one of us get a fee? :)

You probably are making it more difficult than it really is...

A way would be to change the "Copy to Build Directory" property of the
code file to "Copy if newer". This puts the code file in the output
folder. Now, just read the code with "string code =
File.ReadAllText("MyForm.cs");", and show it as normal text.

If you want to show the designer code to, then you need to repeat with
the .Designer.cs file.

Another option, slightly more secretive/cleaner, would be to bundle the
source code text as a resource in the executable, by setting the build
action to "Embedded Resource".
 
If you get a job with this, does one of us get a fee? :)

You probably are making it more difficult than it really is...

A way would be to change the "Copy to Build Directory" property of the
code file to "Copy if newer".  This puts the code file in the output
folder.  Now, just read the code with "string code =
File.ReadAllText("MyForm.cs");", and show it as normal text.

If you want to show the designer code to, then you need to repeat with
the .Designer.cs file.

Another option, slightly more secretive/cleaner, would be to bundle the
source code text as a resource in the executable, by setting the build
action to "Embedded Resource".

That was some great advice :) Although when I tried the last
suggestion for "Embedded Resource" I get this error?:
Error 1 'JVossResume.frmIntroduction.Dispose(bool)': no suitable
method found to override C:\Documents and Settings\BlueSin\My Documents
\Visual Studio 2008\Projects\JVossResume\JVossResume
\frmIntroduction.Designer.cs 14 33 JVossResume
 
That was some great advice :) Although when I tried the last
suggestion for "Embedded Resource" I get this error?:
Error 1 'JVossResume.frmIntroduction.Dispose(bool)': no suitable
method found to override C:\Documents and Settings\BlueSin\My Documents
\Visual Studio 2008\Projects\JVossResume\JVossResume
\frmIntroduction.Designer.cs 14 33 JVossResume

Doh! I guess I don't get the job. I thought you could embed the code
as a resource, but I just tried it. Same problem you described...
 
CSharp-Jay said:
I am currently working on building a programmer resume. The resume is
going to include a series of forms that walk the user through the
resume, showing off my coding abilities as they go. I was thinking it
would be pretty nifty as well to also have perhaps a read only text
box at the bottom of each form where they can view the actual code for
that form. The problem is I can't really think of how to get started
with that, anybody have any ideas?


The MSChart samples at
http://code.msdn.microsoft.com/mschart/Release/ProjectReleases.aspx?ReleaseId=1591
do what you're describing.

ASP.Net and Forms versions are available
 
Doh!  I guess I don't get the job.  I thought you could embed the code
as a resource, but I just tried it.  Same problem you described...

It's alright Mike! I really appreciate the help. I decided to write
a class specifically built to take filename input, read to end and
store the data in a string variable then return the variable value. I
went ahead and took your advice on the Copy to Build Directory though
for sure! If I had money right now I would give ya some, god knows we
all need it in these times lol.
 
It's alright Mike!  I really appreciate the help.  I decided to write
a class specifically built to take filename input, read to end and
store the data in a string variable then return the variable value.  I
went ahead and took your advice on the Copy to Build Directory though
for sure!  If I had money right now I would give ya some, god knows we
all need it in these times lol.

FTM is more knowledgeable than I, but I vote for 'reflection'. you
can do stuff like print the assembly type language using reflection.
Don't ask me how, I've never tried it.

RL
 
Back
Top