简体   繁体   中英

Trouble accessing control through code

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…

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM