foreach (System.Windows.Forms.Button b in this.Controls)Unable to cast object of type 'System.Windows.Forms.GroupBox' to type 'System.Windows.Forms.Button'.
{
b.Image = WindowsApp1.Properties.Resources.BtnImg;
}
Error2:
String temp = ListBox1.Items[0].ToStringCannot convert method group 'ToString' to non-delegate type 'string'. Did you intend to invoke the method?
FroglegPosted Jan 18, 2011, 12:20 AM
foreach (Control b in groupBox1.Controls)
{
if (b is Button)
{
b.BackgroundImage = ArrayCompare.Properties.Resources.BtnImg;
}
}
mark cPosted Jan 17, 2011, 11:36 PM
foreach (Control b in this.Controls & GroupBox1.Controls)
doesn't work?
FroglegPosted Jan 17, 2011, 11:03 PM
foreach (Control b in this.Controls)
{
if (b is Button)
{
b.BackgroundImage = WindowsApp1.Properties.Resources.BtnImg;
}
}
string temp = listbox1.SelectedItem.ToString();