0

I am currently trying to add items to a listview. The problem… it is not in the current form I’m working on.

Target Item located:

Form1
  TabControl1
    Tab2
      SplitPanel1
        Panel1
          listMain

Trying to add items from location:

Form1
  TabControl1
    Tab2
      SplitPanel1
        Panel2
          UserControlForm

I’m sure it’s something easy I’m missing but I can’t seem to figure out how access it from code.

Does anyone have any suggestions? It is all under the same namespace…

LarsTech
  • 80,625
  • 14
  • 153
  • 225
MjM
  • 1

1 Answers1

0

This is not a very clean approach but it can be done. UI controls in WinForms are by default private, so technically you could open up the designer.cs file, find the control, and make it public. However, I'd advise a better design than approaching it this way.

spy890
  • 101
  • 2
  • I did try setting the private to public in the designer.cs file, but that didnt seem to work. What should hte syntax look like for this? – MjM May 06 '13 at 20:24
  • You need to pass a reference to "listMain" into your UserControlForm. Is UserControlForm added at design-time or run-time? – Idle_Mind May 06 '13 at 21:15
  • the forms are static design, I create UserControlForm objects durin g application load so that I can quickly load them into panel2 when selected in the tree view in panel1. – MjM May 06 '13 at 22:43