0

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

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Dendei
0

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();
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.