I have an application which consi开发者_如何转开发sts of a couple of windows along with the main one. Please help me to extract some data present in one of these windows using c#..
If I understand you're question properly, you have a popup window or dialog or some such, and you need to retrieve information from it after it has been closed (or some command is issued). There is no intrinsic way to do this with Windows Forms. You need to expose the data yourself:
class SomeForm: Form
{
public string MyTextField
{
get { return txtMyField.Text; } // Gets the Text value of a control named txtMyField on this form
}
}
// ...
var form = new SomeForm();
if (form.ShowDialog(this) == DialogResult.Ok)
{
string data = form.MyTextField;
}
精彩评论