Do you remember what I told you this morning, about casting controls?
"If a Control is a ComboBox, then it can't also be a Label! So when you execute
ComboBox cb = sender as ComboBox;
Label lb = sender as Label;
You are guaranteed that one of the two variables will be null - so when you try to use both, you are certain to get the error."
That applies to Buttons and ComboBoxes as well:
Button btnh = sender as Button;
ComboBox cb1 = sender as ComboBox;
Any by the way - don't transfer data like this:
Form4 f4 = new Form4();
f4.comboBox1.Text = bs.Text;
Make the ComboBox in Form4 private again, and use a property instead:
In Form4:
public string WhateverTheComboBoxIsMeantToDoUseYourOwnNameHere
{
get { return comboBox1.Text; }
set { comboBox1.Text = value; }
}
That way, you can change the design of Form4 later without it affecting forms outside it. (Remember the OOPs fundimentals!)
[edit]"Labels" changed to "ComboBoxes" - OriginalGriff[/edit]