How did you deal with "Reference Requirements for Non-Shared Members"?

xiaoxiao2021-03-06  65

When we write a form in Visual Basic .NET, we actually write a class. After writing, press F5, actually can run! It turns out that VB has already helped us to create an instance of this class, it is incredible! You may think this is so geography, you don't have to pay attention to it at all! Oh, most of the case is indeed like this. However, if you write another form in the program and create an instance of it, you want to call a data member or a method of the main form by clicking a button in a new form, you will How to achieve it? I will say a maximum plan first (I think it should be my original huh): Add a Timer1 control in the main form, Timer1 every Tick, you let the program determine if the new form is pressed, if If it is, the event is called - if you set the interval value, you will simulate it very much. Is it? But I have written programs for a few months, I have not used this method, there is no way, there is no master skill! It is simple, all of our questions are in line with how to solve the problem of "reference requirements for non-shared members". You may have to do it early, you can't stop, how can you create a main form instance through the Sub Main in the module? Yes, this is a viable way, it is indeed feasible - but not actually, so I don't want to say more here. Everyone has seen the "hacker empire"? The bad head inside, every time you copy yourself, you don't forget to say a few "me me". Yeah, the instance of each form is ME! The key is how to pass ME to a new form? Moving a brain, what is the event is to connect the main form and a new form directly? Harvara is a new form of New's instance constructor. Although this subneware is no parameters by default, I know that this is hard to fall. You only need to rewrite, set the parameters in the overloaded Sub New to "ByVal thisform as frmmain", then define a global variable to receive the ME of the main form in Sub New! Such a problem, the general book is not found. I don't know if they think this method is simple enough, or the level of people who write books is not high. Anyway, if you want to learn something, don't always hold this book to hide at home, pay more attention to the network resources huh.

转载请注明原文地址:https://www.9cbs.com/read-110686.html

New Post(0)