c# - How can I access winForm Common control inside helper class? -
i have windows form , want use below code inside helper class. made richtextbox , tabcontrol modifier public, still cant access richtextbox. gives error @ richtextbox1 saying
the name richtextbox1 doesnt exist in current context
what doing wrong?
helper class
list<string> commentlines = richtextbox1.lines.tolist();
you're code sample pretty incomplete. however...
you'll need pass reference richtextbox method or class constructor (depending on code):
// helperclass method public static void updatecommentlines(richtextbox richtextbox) { list<string> commentlines = richtextbox.lines.tolist(); } // winform code public void dosomething() { helperclass.updatecommentlines(this.richtextbox1); }
Comments
Post a Comment