So, I am making a very simple application in Notepad++ and right now, it is only like CMD! How do I add UI to this C# Application WITHOUT VISUAL STUDIO? Google gives me nothing but Visual Studio tutorials and I want to be able to program without an IDE. Also, just give me an example of adding a simple button in C#.
-
1Why do you want to do this without using Visual Studio? You can get the express versions for free. – Tim Nov 23 '14 at 19:04
-
Adding a simple button to what? You have no window to add it to yet, you'll need to deal with that first. – Nov 23 '14 at 19:04
-
why can't you use visual studio? – thumbmunkeys Nov 23 '14 at 19:04
-
a very simple app becomes much less so if you are manually coding the UI; create a form, initialize it, create a button, add it to the form etc – Ňɏssa Pøngjǣrdenlarp Nov 23 '14 at 19:04
2 Answers
You'll have to write all the Forms/UI code yourself manually as well as manage your events / logic code.
Here goes a simple Form with a Button that shows a Message Box. You can see other examples, as answered on stackoverflow here and here.
using System;
using System.Drawing;
using System.Windows.Forms;
namespace CSharpGUI {
public class WinFormExample : Form {
private Button button;
public WinFormExample() {
DisplayGUI();
}
private void DisplayGUI() {
this.Name = "WinForm Example";
this.Text = "WinForm Example";
this.Size = new Size(150, 150);
this.StartPosition = FormStartPosition.CenterScreen;
button = new Button();
button.Name = "button";
button.Text = "Click Me!";
button.Size = new Size(this.Width - 50, this.Height - 100);
button.Location = new Point(
(this.Width - button.Width) / 3 ,
(this.Height - button.Height) / 3);
button.Click += new System.EventHandler(this.MyButtonClick);
this.Controls.Add(button);
}
private void MyButtonClick(object source, EventArgs e) {
MessageBox.Show("My First WinForm Application");
}
public static void Main(String[] args) {
Application.Run(new WinFormExample());
}
}
}

- 1
- 1

- 2,332
- 3
- 24
- 40
Visual Studio is not any plugin to generate a UI for your application, you can do that in your Notepad++ too. What you need to be using or looking for is a framework which would allow you to use such feature.
In .NET framework, you can use Windows Forms or Windows Presentation Foundation to create the applications with Buttons, TextBox and TextBlock controls. You would be able to get the assemblies required to work with such frameworks in your own IDE too.
The button in WPF or Win Forms is as simple as
// create the button instance for your application
Button button = new Button();
// add it to form or UI element; depending on the framework you use.
.. but you need to be having those frameworks added, you can look into Web Froms or WPF on MSDN. Just install the frameworks, add them to the Notepad++ to use them in Notepad++.

- 15,669
- 12
- 55
- 103