Click here to Skip to main content
15,888,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey guys,

i am making my programming language, but i need to make new windows forms. I need to be able to type in a code like:

new winform


and then it makes a whole new windows form. Not so that when i make it, it have a windows form already, but being able to make one using code.
Posted

1 solution

You can't quite do that - Console applications do not have a message loop in the same way that Windows forms apps do.
You can execute a Windows Forms application using Process.Start, and talk to it from there, but you can't create a windows form within a console app.
 
Share this answer
 
Comments
Member 8378691 4-Jun-12 3:28am    
what about running a console application in a windows form? i want to be able to run my programming language in a console application. So if i make a windows form for my programming language and then press a run button, will i be able to run the code within a console application? if so, can you please tell me how and give me some code?
OriginalGriff 4-Jun-12 4:01am    
I't not easy to answer that: Windows forms and consoles work in very different ways.
Consoles are functional - they run continuously, unless they specifically stop while looking for something, at which point they do nothing at all. The most obvious example is that a console app will do nothing at all until the user presses a button to say "do it", at which point they run all the time until they need more info from the user.
Windows forms aren't like that - they don't actually run until something happens that they know how to handle. At which point they do as little as possible, and wait for the next event to happen. If you run continuously as a result of an event in a windows form, then the display freezes up and users assume it is broken.

(This is a vast oversimplification, I know)

So it is difficult to see where you are trying to go with a console-based windows app, or a windows-based console app.
What are you trying to achieve?

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