Hi, i made a class in a win form app in c#. I want to open the class/degbue it when someone presses button3.
How do i do that?

Do this:

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MyClass mc = new MyClass();
            mc.MyMethod();
        }
    }

    public class MyClass
    {
        public void MyMethod()
        {
            System.Windows.Forms.MessageBox.Show("This is a message from my class.");
        }
    }

This is the code in my class:

static void main(string[] args)
        {
            string kommando = Console.ReadLine();
            if (kommando == "areal")
            {
                Console.WriteLine("k = kvadrat");
                Console.WriteLine("r = rektangel");
                Console.WriteLine("t = trekant");
                Console.WriteLine("s = sirkel");
console.readkey();
}

How will it be then? :L

This is the code in my class:

static void main(string[] args)
        {
            string kommando = Console.ReadLine();
            if (kommando == "areal")
            {
                Console.WriteLine("k = kvadrat");
                Console.WriteLine("r = rektangel");
                Console.WriteLine("t = trekant");
                Console.WriteLine("s = sirkel");
console.readkey();
}

How will it be then? :L

Seeing your code, what do you mean by open a class?

I want to show the class in a console app when someone presses button3

What do you mean by "show it"? Classes aren't things you 'show'. They have methods and properties that you get, set or call.

what is the point of the argument, it is never used

string[] args
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.