我遍历得到了页面上所有的picturebox,但是我想把有个特殊的picturebox排除,语句应该怎么写,
foreach(Control control in this .Controls)
{
if(control.GetType () == typeof(PictureBox) && control.Name !=pBx_bjl)
{
code.............
}
}
总不至于这么写吧,
foreach(Control control in this .Controls)
{
if(control.GetType () == typeof(PictureBox) && control.Name !=pBx_bjl)
{
code.............
}
}
总不至于这么写吧,
你看这样写行不?嘎嘎~foreach(Control control in this .Controls)
{
if(control.GetType () == typeof(PictureBox) )
{
if(control.Name !=pBx_bjl)
{
code.............
}
}
}
肯定行!!
D:\My Documents\Visual Studio Projects\lwj\BJL\Form1.cs(200): 运算符“!=”无法应用于“string”和“System.Windows.Forms.PictureBox”类型的操作数
{
if(picb.Name ==???)
{
……
}
} 我经常遍列txtbox就这样哈
{
if(control.GetType () == typeof(PictureBox))
if(control.Name == "pBx_bjl")
continue;
{
code.............
}
}
如果太多太多的picturebox 怎么一一列举啊,
应该是control.Name !=[color=#FF00FF]"pBx_bjl"[/color]