C
C#2y ago
OSWIN

❔ ✅ Winforms

my code creates a new form when a button is clicked but how do i get that new forms code and display it in that editing window any help?
12 Replies
Anu6is
Anu6is2y ago
Editing window? You mean the form designer or code viewer in VS? If so, you can't see a runtime (code) generated form in the editor You can make a form in the designer and have your button open that
OSWIN
OSWINOP2y ago
@anu6is this is what i meant via editor being able to add buttons and what not
Anu6is
Anu6is2y ago
Ok, but I still don't understand your question Yes this is the editor. What is the code you have that creates a form?
OSWIN
OSWINOP2y ago
@anu6is
TheBoxyBear
TheBoxyBear2y ago
You need to create it as a form in the project and create an instance of it when the button is clicked
Anu6is
Anu6is2y ago
^ Like I said, if you are creating that form in code you can't see it in the editor You have to create it in the editor FIRST, then have your code show it The only way you can edit it in the designer is to create it in the designer
OSWIN
OSWINOP2y ago
ahhh now i get it where do i create a form in editor tho its not in toolbox
Anu6is
Anu6is2y ago
You add form like you'd add a class in the solution explorer
OSWIN
OSWINOP2y ago
done thanks !close
Accord
Accord2y ago
Closed!
Jdance
Jdance2y ago
Awfully confused by this, but are you simply trying to execute code when the button is pressed? Didn't realize it was closed, my bad. 🤦‍♂️ Ignore my stupidity.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?