2011-07-18 8 views

答えて

1

に呼び出し元のフォームが選択された値にアクセスできるようになりますフォーム上のパブリックプロパティを作成することをテキストボックスにそれらを見ることができますボタンを押したときにそれを行う方法を

public partial class SelectionForm : Form 
{ 
    public SelectionForm() 
    { 
     InitializeComponent(); 
    } 

    //Selection holder 
    private string _selection; 

    //Public access to this item 
    public string Selection { get { return _selection; } } 

    private void button1_Click(object sender, EventArgs e) 
    { 
     _selection = "One was selected"; 
     this.Close(); 
    } 

    private void button2_Click(object sender, EventArgs e) 
    { 
     _selection = "Two was selected"; 
     this.Close(); 
    } 
} 

あなたの呼び出しフォームから、フォームが破棄される前にこの値を取得できます。

関連する問題