HI
i am makinng a windows form project and facing difficulty in passing the dnamically generated control value to the other form's normal control value.
my code is like
int c = 0;
int p = 0;
private void button1_Click(object sender, EventArgs e)
{
panel1.VerticalScroll.Value = VerticalScroll.Minimum;
ComboBox txtRun3 = new ComboBox();
txtRun3.Name = "txtDynamic" + c++ ;
txtRun3.Location = new Point(30, 18 + (30 * c))
panel1.Controls.Add(txtRun3);
txtRun3.Focus();
}
private void button2_Click(object sender, EventArgs e)
{
Form4 f4 = new Form4();
ComboBox cb1 = sender as ComboBox;
Button bs = cb1.Tag as Button;
f4.comboBox1.Text = bs.Text;
f4.Show();
}
i am getting error as
"Object reference not set to an instance of an object."