Visual C# Access item from other class file -


im writing an application in a studio and trying to reach a rich text box from another class. It does not seem to work for me. Besides how do I call a function from another class?

My code:

  Nom place Test {Public Partial Class} Form 1: Form {Public Form 1 () {// I MyClass.test ("Hello") From this place you want to reach; }}} Nom place Test {class MyClass {public zero test (string text) {// here I want to richtextbox1.clear (); But the text box is not available}}}    

can be done in many ways The favorite will pass the "this" indicator as a "logic" and declare the object of the "Myclass" class in "Form 1", thus, all members of the "MyClass" class and the public functions "Form 1" Access will include access to the Reichbox 1.

  Nom place Test {Public Partial Category} Form 1: Form {MyClass MyClassObject; Public Form 1 () {Initialization (); MyClassObject = New MyClass (this); MyClassObject.test ("Hello"); }}} Namespace test {class MyClass {form 1 guardian; Public MyClass (Form 1 Parentform) {Parents = Parents; } Public Zero Test (string text) {parent.richtextbox1.clear (); }}   

}

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -