在 flowlayout 面板内双击打开标签上的表单
Open form on label double click inside flowlayout panel
我正在尝试 Double Click
在 FlowLayoutPanel
中的 Label
上,标签是动态创建的。
我正在尝试使用此
打开表单
foreach(Label label in myFlp )
{
var Id = label.Name.ToString();
int personID;
if (!String.IsNullOrWhiteSpace(Id) && int.TryParse(Id, out personID))
{
FrmAddress frmAddress = new FrmAddress(_controller, personID);
frmAddress.ShowDialog();
frmAddress.Dispose();
}
}
收到此错误;
foreach statement cannot operate on variables of type 'System.Windows.Forms.FlowLayoutPanel' because 'System.Windows.Forms.FlowLayoutPanel' does not contain a public definition for 'GetEnumerator'
尝试这样的事情:
foreach(var control in myFLp.Controls)
{
if(control is Label)
var Id = (Label)control.Name.ToString();
int personID;
if (!String.IsNullOrWhiteSpace(Id) && int.TryParse(Id, out personID))
{
FrmAddress frmAddress = new FrmAddress(_controller, personID);
frmAddress.ShowDialog();
frmAddress.Dispose();
}
}
我正在尝试 Double Click
在 FlowLayoutPanel
中的 Label
上,标签是动态创建的。
我正在尝试使用此
foreach(Label label in myFlp )
{
var Id = label.Name.ToString();
int personID;
if (!String.IsNullOrWhiteSpace(Id) && int.TryParse(Id, out personID))
{
FrmAddress frmAddress = new FrmAddress(_controller, personID);
frmAddress.ShowDialog();
frmAddress.Dispose();
}
}
收到此错误;
foreach statement cannot operate on variables of type 'System.Windows.Forms.FlowLayoutPanel' because 'System.Windows.Forms.FlowLayoutPanel' does not contain a public definition for 'GetEnumerator'
尝试这样的事情:
foreach(var control in myFLp.Controls)
{
if(control is Label)
var Id = (Label)control.Name.ToString();
int personID;
if (!String.IsNullOrWhiteSpace(Id) && int.TryParse(Id, out personID))
{
FrmAddress frmAddress = new FrmAddress(_controller, personID);
frmAddress.ShowDialog();
frmAddress.Dispose();
}
}