I am confused as to why a Window will not appear with the below code. Am I missing an import?
using System.Text;
using System.Xml;
using System.Windows;
using System;
using System.Windows.Forms;
using System.IO;
using System.Threading;
public class Program {
public Window mainWindow;
static void main() {
// Create the application's main window
mainWindow = new Window();
mainWindow.Title = "Enter SN";
mainWindow.Show();
}
}
You want to run your Window via an Application.Run() call. Your current code will not fire it off on a standard windows message loop, which is required.
Remove your Show() call and replace it with:
To be even simpler, if you set your title as your wish on your WinForms designer, your main can be a single line:
Also, you have many unnecessary using statements. These statements aren't a real problem, just unnecessary and confusing.