Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 0.65 KB  |  hits: 4  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to inherit variables from between forms in Visual Studio, C  
  2. public ref class Form2 : public System::Windows::Forms::Form
  3. {
  4.  
  5. public ref class Form1 : public System::Windows::Forms::Form
  6. {
  7.        
  8. public ref class Form2 : public System::Windows::Forms::Form, public Form1
  9. {
  10.        
  11. public ref class Form2 : public Form1
  12. {
  13.        
  14. public interface IMyForm
  15. {
  16.     int MyValue { get; set; }
  17. }
  18.  
  19. public class Form1 : System.Windows.Forms.Form, IMyForm
  20. {
  21.    public int MyValue { get; set; }
  22.    ...
  23. }
  24.  
  25. public class Form2 : System.Windows.Forms.Form, IMyForm
  26. {
  27.    public int MyValue { get; set; }
  28.    ...
  29. }
  30.        
  31. public void DoSomething(IMyForm form)
  32. {
  33.     form.MyValue = 5;
  34. }