I started a project as a console app in visual studios and I'm now finding that I need a UI (form) but when I run the program it beings up a console. Is there anyway of having my Program.cs code from my console app run from a button event?
Spinet of my Code:
using System;
using System.Net.Sockets;
using System.IO;
public class Program
{
public static string name = null;
public static string userloc = null;
public static string protocol = null;
public static int Portal = 43;
public static string Address = "whois.net.dcs.hull.ac.uk";
static void Main(string[] args)
{
for (int i = 0; i < args.Length; i++)
{
switch (args[i])
{
case "-h0":
protocol = "-h0";
break;
case "-h1":
protocol = "-h1";
break;
case "-p":
Portal = int.Parse(args[i + 1]);
++i;
break;
Form Code:
namespace location
{
public partial class Location : Form
{
public Location()
{
InitializeComponent();
}
private void updateBtn_Click(object sender, EventArgs e)
{
}
}
}