Skip to content

Instantly share code, notes, and snippets.

@sonerb
Created December 21, 2020 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sonerb/907aff3fc976784040da702e14df6cd5 to your computer and use it in GitHub Desktop.
Save sonerb/907aff3fc976784040da702e14df6cd5 to your computer and use it in GitHub Desktop.
using System;
using System.Windows.Forms;
namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
MyClass mc = new MyClass();
public Form1()
{
InitializeComponent();
mc.myLabel = label1;
}
private void button1_Click(object sender, EventArgs e)
{
mc.Value = textBox1.Text;
}
}
}
using System.Windows.Forms;
namespace WindowsFormsApp2
{
class MyClass
{
public Label myLabel;
public string _value;
public string Value
{
get
{
return _value;
}
set
{
_value = value;
myLabel.Text = _value;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment