D
D
Denis Sivkovich2018-05-12 14:29:03
C++ / C#
Denis Sivkovich, 2018-05-12 14:29:03

Code conflicts with closing winform, how to fix it?

https://cloud.mail.ru/public/KgHg/AVhEYgMoF
Please watch the video and help please))
5af6d369353f6095770985.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peter, 2018-05-12
@Morpheus_God

NullReferenceException is usually thrown if somewhere there is a call to something, but the object itself has not been created yet.
I will give an example you have a class Person

class Person
    {
        public string Name;
        public string Surname;
    }

You do like this:
class Program
    {
       static Person person;

        static void Main(string[] args)
        {
            person.Name = "Jim";

            Console.WriteLine(person.Name);
            Console.ReadKey();
        }
    }

This code will also throw a NullReferenceException. And all because you did not initialize the class.
See your code. Apparently you do not create an object. Or maybe it is created, but much later than you are trying to call it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question