making a window
I want to make a window (not just selecting a windows form either) from code.
The peices of code I got so far are this:
my using statements
starting code or somthing
and ending code I belive
public class FeaturedForm : Form
I also saw you can add STAThread before static void main()
static void Main()
so with that how do I make a window apear?
Ok I have made a window but now I got the black console window behind the window. How do I get rid of or make it so the console window doen't apear.
There should be a compiler switch for CONSOLE or WINDOWS subsystem. If you select windows, no console window will appear.
alright well than the problem is, I am using code DOM. I want the program be able to make a windows program and that is the hard part.
When you call the compiler in the CSharpCodeDomProvider (I think) you pass in a number of options - one is whether or not to create an exe, one is whether to create a console or Win32 program.
I believe that is what is needed - /target=winexe is a parameter to the 'csc' C# compiler that says to make a Windows file.
// Create an instance of the CSharpCodeProvider class.
Microsoft.CSharp.CSharpCodeProvider provider = new CSharpCodeProvider();
// Call the CodeDomProvider.CreateCompiler() method to obtain an ICodeCompiler from the provider.
System.CodeDom.Compiler.ICodeCompiler compiler = provider.CreateCompiler();
CompilerParameters cp = new CompilerParameters(referenceAssemblies,
// Generate an executable rather than a DLL file.
cp.GenerateExecutable = true;
cp.CompilerOptions += "/target=winexe";
// Invoke compilation.
CompilerResults cr = compiler.CompileAssemblyFromFile(cp, sourceFile);
You were close, it is
Found that after I knew what I was looking for.
Ahh sorry my mistake, I used the .NET 2.0 CSC, where it's /target:winexe or /t:winexe. Glad to help :)