Click here to Skip to main content
15,886,693 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys! I really want to find a way of how to build or export one single form from Visual Studio in one executable file in VB.NET

Something like this: In form one I have a button, when I press it the second form goes as executable in the path "C:\"

I want to crate a game for one kindergarten, but I really don't find a solution at this point.
Posted
Updated 6-Oct-15 22:16pm
v2

1 solution

It's not difficult, but it's going to be fiddly.
First create a "template" of the application as a file - create a basic forms project, and combine all the program.cs, and form.cd, form.designer.cs files into a single file called template.cs

Then your application can use that as a base for the application you want to produce. Write the modified file as "MyApp.cs" and try the command line:
%FrameworkDir%\v4.0.30319\csc.exe MyApp.cs
via Process.Start (you may need to change the version detail for the Framework available on the PC).

This should produce an exe: MyApp.exe.

But do not try to do this in the root directory! Access to this is restricted for security reasons and producing an exe file there is very unlikely to succeed. Create an "open permission" folder and do it all there.
 
Share this answer
 
Comments
Netero 7-Oct-15 13:47pm    
Thank you!

Is pretty hard for me to understand, since I just started learning this language. Would you like to create and send me an example source or any kind of link?

I don't understand at all, especially how to combine all those codes.
OriginalGriff 7-Oct-15 14:09pm    
Nope! :laugh:
But it's pretty easy for you to do: edit the three files, copy the content, and paste them all together into one file. You may need to trim a couple of bits (like the two form class statements with the same name) but it'll probably work "as is" in a single file. Try pasting them into a new NotePad file, and save it as "MyApp.cs" in a new, clean folder just to try it out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900