hey i have a question how do i get my funktion to work in the design.cs?

namespace Visma_projekt
{
    public class BlackJack
    {
        public string[] Cards = new string[51];
        public void SkapaKort()
        {
            System.Console.WriteLine("Ehhhh");
        }      
    }
}

i want to call the funktion from this code visma.cs into the form1 design button

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

        private void btnsubmit_Click(object sender, EventArgs e)
        {
            BlackJack.CreateCards(); 
        }
    }
}

the first code is visma.cs
the secound one is form1.cs
thank you for answers

Re: Call a funktion into my design 80 80

Since SkapaKort is not a static method, you'll need to create an object of type BlackJack then call the method through that object, i.e.

BlackJack myObject = new BlackJack();
myObject.SkapaKort();
Re: Call a funktion into my design 80 80

thank you Momerath works good :)

Be a part of the DaniWeb community

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