我正在使用C#开发WinForms应用程序。 我想要实现的目标是从用户获取文件,为此我使用了以下代码:
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
string sFileName = dlg.FileName;
//my code goes here
}
现在,一切都正常工作,但我想把3个单选按钮放在同一个对话框中,也就是说,我现在可以从这个对话框中获得两件事情。
string sFileName = dlg.FileName; //same as in case of traditional dialog box
//some thing like this which tells which radio button is selected:
dlg.rbTypes.Selected
我该如何实现这个?