C# and Variable Scope in Winforms -
Within a Winfix app, I want to make the data accessible from many form controls in an immediate category.
What is my best option to be able to use Class Instance in this way?
You have many options available, but this is probably the easiest way to create VS 2005.
using the system; Using System.Collections.Generic; Using System.ComponentModel; Using System.Data; Using System.Drawing; Using System.Text; Using System.Windows.Forms; Namespace Test {Public Partial Class Form 1: Form {foo a; Public Form 1 () {Initialization (); } Private Zero Button 1_Click (Object Sender, EventArgs e) {a = new foo (); A.name = "bar"; } Private Zero Button 2_Click (Object Sender, EventArgs E) {If (a! = Null & a.name! = Null) MessageBox.Show (a.name); Other messageboxes Show (""); }} Public square foo {string _name; Public string name {get {return _name; } Set {_name = value; }} Public foo () {}}}
Comments
Post a Comment