Q
queanbeyan
Hi
I am working through some trivial examples using properties and using
'get' and 'set', but I dont seem to return the value that i expect.
this code below runs but when I click on the button I expect to have
the text that was put in the tbInput box copied to the tbOutput box.
But I only get a blank.. I have looked in the locals in visual studio
but dont see that the value on tbInput.text is passed to the input or
Input string.
Any help appreciated.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace getset
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private string input;
public string Input
{
get
{
return input;
}
set
{
input = tbInput.Text;
}
}
private void btnGet_Click(object sender, EventArgs e)
{
tbOutput.Text=input;
}
}
}
I am working through some trivial examples using properties and using
'get' and 'set', but I dont seem to return the value that i expect.
this code below runs but when I click on the button I expect to have
the text that was put in the tbInput box copied to the tbOutput box.
But I only get a blank.. I have looked in the locals in visual studio
but dont see that the value on tbInput.text is passed to the input or
Input string.
Any help appreciated.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace getset
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private string input;
public string Input
{
get
{
return input;
}
set
{
input = tbInput.Text;
}
}
private void btnGet_Click(object sender, EventArgs e)
{
tbOutput.Text=input;
}
}
}