textの内容を変更する方法について
public
class
fact {
private
bool
_Clicked;
public
bool
clicked {
get
{
return
_Clicked; }
set
{ _Clicked
=
value; } }
private
string
_GetText;
public
string
getText {
get
{
if
(_Clicked) { _GetText
=
"
答えが正しい
"
; }
else
{ _GetText
=
"
答えを誤る
"
; }
return
_GetText; } } }
C# code
class
fact {
private
bool
_Clicked;
public
bool
clicked {
get
{
return
_Clicked; }
set
{ _Clicked
=
value; } }
private
string
_GetText;
public
string
getText {
get
{
if
(_Clicked) { _GetText
=
"
答えが正しい
"
; }
else
{ _GetText
=
"
答えを誤る
"
; }
return
_GetText; } } }
C# code
public
partial
class
Form3 : Form { BindingSource bindingSource1
=
new
BindingSource();
public
Form3() { InitializeComponent(); }
private
void
button1_Click(
object
sender, EventArgs e) { fact _fact
=
new
fact(); _fact.clicked
=
true
; bindingSource1.Add(_fact); label1.DataBindings.Add(
"
Text
"
, bindingSource1,
"
getText
"
); } }