-1

what does it mean Object reference not set to an instance of an object in the line below?

case "S Connected":
                        List dd6 = new List(textBox1.Text);
                        **dd6.textBox2.Text = id.ToString();**
                        dd6.ShowDialog();
Diegoctn
  • 55
  • 1
  • 10

1 Answers1

-1

Thanks, guys. The first case works perfectly, the W connected and the S connected retrieve the error:

  private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
    {
        var id = dataGridView1.CurrentRow.Cells["Id"].Value;
        var BBB = dataGridView1.CurrentRow.Cells["Connected"].Value;
        string idd = id.ToString();
        string BBB2 = BBB.ToString();
        textBox1.Text = id.ToString();
                switch (BBB2)
                {
                    case "Standalone":
                        ListStandalone dd = new ListStandalone(textBox1.Text);
                        dd.textBox2.Text = id.ToString();
                        dd.ShowDialog();
                        break;
                    case "W Connected":
                        ListW da2 = new ListW(textBox1.Text);
                        da2.textBox2.Text = id.ToString();
                        da2.ShowDialog();
                        break;
                    case "S Connected":
                        ListS dd6 = new ListS(textBox1.Text);
                        dd6.textBox2.Text = id.ToString();
                        dd6.ShowDialog();
                        break;
                    case "Retail":
                        PrintRetail dd4 = new PrintRetail(textBox1.Text);
                        dd4.Show();

                        break;
                }
Diegoctn
  • 55
  • 1
  • 10