I'm being asked to access label开发者_运维问答s, text boxes, and combo boxes from another form. From the input form to the main form using this:
frmInput input = new frmInput();
This ^^ is in my main form. When i go to use "intelesense" it doesn't show any of the labels or anything that i need. Suggestions?
Because by default GUI elements are defined with private access. If you want to expose them then define your own properties for these elements. You also needs to pass the reference to your main form to the input form... However not recommended.
Instead you can use Events to communicate data between form and keep the rendering to the control's parent form.
That controls can be declared private or protected and that's why you can't access them. However you can either make them public or access by name:
input.Controls["someButtonName"]
精彩评论