C# Windows Forms Application? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C# Windows Forms Application?

I have very little programming experience. Using Visual Studio Community, I can create a window with C#. The window creation requires that I use drag and drop to add things to the window. Is it possible to do all of this by just typing code? Like creating a window and adding things like buttons and text boxes without relying on drag and drop? I mean, drag and drop is nice and easy, and i'd prefer that over just typing code, but i'm just curious xD

3rd Dec 2018, 4:25 PM
Daniel Cooper
Daniel Cooper - avatar
3 Answers
+ 5
Sure, every form or button or text box has been created for you using classes and methods somebody else has written, so, of course you can do it yourself. This is something similar, you may find it useful, take a look: https://docs.microsoft.com/en-us/dotnet/framework/winforms/how-to-create-a-windows-forms-application-from-the-command-line
3rd Dec 2018, 4:40 PM
dρlυѕρlυѕ
dρlυѕρlυѕ - avatar
+ 1
This is a good question. Take my answer with a grain of salt because I haven't made much windows form applications but I would say yes. Anyone else feel free to correct me if I'm wrong, but this is handled by the .NET framework. Which is a collection of libraries to make your life allot easier using c#. That being said you can make your own libraries for your project. With that in mind in don't see why it wouldn't be possible to do it yourself. But again haven't worked much with wfa so if I'm wrong I'd gladly hear so from someone else.
3rd Dec 2018, 4:37 PM
Tihomir Balaban
Tihomir Balaban - avatar
+ 1
This dynamically creates a TextBox control and adds it to the windows form. TextBox tb = New TextBox; tb. Location = New Point(50,100); this.Controls.Add(tb);
3rd Dec 2018, 6:17 PM
Asgar Ali
Asgar Ali - avatar