Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

How to use a variable in a subroutine to call a usercontrol and it's properties in a c# winform

$
0
0









I am bringing a few user controls to my c# winform and I am basically doing the same thing again and again. Every time I click a button on the main form and one of the user controls is visible it calls a property of that user control to occur and if a different user control is visible it calls a different property of a that user control to occur since basically the same code is happening by the button click regardless of which user control is visible I would like to save code space and make a subroutine that essentially does the same thing it just uses a different user control and user control property per user control and I would like to have a parameter of the subroutine something like this

private void DoSomething(UserControl usercontrol, UserControlProperty property)

{
usercontrol.property

}

DoSomething(Products, Products.Fill);


Debra has a question


Viewing all articles
Browse latest Browse all 12583

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>