I am new to c# and this project is for the purpose of learning only. I trying to make a program where the user enters some information inn a command line, and then the result is displayed in a forms window. How can I make that work?
Here is my failed attempt:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Øving1
{
class Program
{
static int Length;
static int Width;
[STAThread]
static void Main(string[] args)
{
GUI test = new GUI();
Console.WriteLine("Dette Programet regner ut areal og omkrets av et rektangel, angi en lengde og brede(eks. 10 enter 10)");
Length = Convert.ToInt32(Console.ReadLine());
Width = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("AREAL: " + Area(Length, Width) + " OMKRETS: " + Circumference(Length, Width));
test.richTextBox1.Clear();
test.richTextBox1.AppendText("AREAL: " + Area(Length, Width) + " OMKRETS: " + Circumference(Length, Width));
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(test);
}
public static int Area(int Length, int Width)
{
return Length * Width;
}
public static int Circumference(int Length, int Width)
{
return (Length * 2) + (Width * 2);
}