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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -