labelTotal は、クラス Keypad (C# WinForms) の値を保持します。ToString は、labelTotal.Text を返すようにオーバーライドされました。
namespace Gui3
{
public partial class Keypad : Form
{
public Keypad()
{
InitializeComponent();
}
public override String ToString() {return labelTotal.Text;}
private void buttonOk_Click(object sender, EventArgs e)
{
this.Close();
}
...
keypad.ShowDialog().ToString() が labelTotal.Text を返さないのはなぜですか?
namespace Gui3
{
public partial class Setup : Form
{
public Setup()
{
InitializeComponent();
}
private void buttonStartDepth_Click(object sender, EventArgs e)
{
Keypad keypad = new Keypad();
////////// Not working as expected /////////
String total = keypad.ShowDialog().ToString();
...