3 回答

TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超4個(gè)贊
創(chuàng)建一個(gè)屬性(或方法)FormOptions
,比如說(shuō)GetMyResult
:
using (FormOptions formOptions = new FormOptions()){ formOptions.ShowDialog(); string result = formOptions.GetMyResult; // do what ever with result...}

TA貢獻(xiàn)1812條經(jīng)驗(yàn) 獲得超5個(gè)贊
您還可以創(chuàng)建公共屬性。
// Using and namespace...
public partial class FormOptions : Form
{
private string _MyString; // Use this
public string MyString { // in
get { return _MyString; } // .NET
} // 2.0
public string MyString { get; } // In .NET 3.0 or newer
// The rest of the form code
}
然后你可以得到它:
FormOptions formOptions = new FormOptions();
formOptions.ShowDialog();
string myString = formOptions.MyString;
- 3 回答
- 0 關(guān)注
- 364 瀏覽
添加回答
舉報(bào)