Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to make a methode accessible from all the forms c#

you can use an interface 
  
  1-Create an interface (Let's call it myInterface)
  2- Add a public static method in myInterface (The method can be return any type or it can be void) 
  //  void Mymethod();
  3- override the method in any forms you want (
      for that 
         you should implement the interface in the form 
                  //  public partial class theForm : Form , myInterface
          Then overrid the method this way 
                  // myInterface.Mymethod(){
                     //do some coding
                  
                  }
   4-And when ever you want to use it call it this way 
    //   myInterface NameIt = (myInterface)Application.OpenForms["theForm"];

      //if (NameIt != null) NameIt.Mymethod();
    
Comment

PREVIOUS NEXT
Code Example
Csharp :: internal static object ds 
Csharp :: All and Any linq c# examlpe replace 
Csharp :: stateteach.net 
Csharp :: wpf xaml group of buttons 
Csharp :: unity cone hit test spotlight lits object light on object test 
Csharp :: list in c# foreach 
Csharp :: c# read only file used by other app 
Csharp :: unity3d spin wheel 
Csharp :: C# sprint key 
Csharp :: Function delegate 
Csharp :: BOTON PARA CAMBIAR DE VIEW ASP.NET 
Csharp :: there is no renderer attached to the gameobject 
Csharp :: C# free text search 
Csharp :: c# get count from unknown list 
Csharp :: screenshot c# WinForms 
Csharp :: how to if i enter 1 go to this program C# 
Csharp :: c# bitwise or 
Csharp :: C# count specific words in string 
Csharp :: getcomponent rigidbody2d 
Csharp :: listview android studio java 
Csharp :: shallow copy vs deep copy c# 
Csharp :: thread c# 
Csharp :: c# form 
Csharp :: get multi-selected rows gridcontrol devexpress 
Csharp :: how to move balance from one card to another target 
Csharp :: convert foreach to linq c# 
Html :: ssss 
Html :: only accept image file input 
Html :: html disable drag image 
Html :: html center image vertically bootstrap 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =