Accessing Textbox in different Class - Forum - OpenEdge General - Progress Community

Accessing Textbox in different Class

 Forum

Accessing Textbox in different Class

This question is not answered

I have a Telerik form(FormA.cls) that contains a textbox (vTextbox1). FormA also dynamically loads a separate Radform class (FormB.cls) into a Tab. FormB contains a button (bButton) and textbox (vTextbox2). If I create a click event in bButton,  what is the best way to get the value in vTextbox1 to display in vTextbox2 or viceversa?

Thanks

Mark

All Replies
  • Either use a public method to get/set the textbox value or go for publish/subscribe - aka, named events in your case… the later has the advantage of not strongly coupling the two classes with the drawback of being slightly more ‘complicate’ and asynchronous.

    Whatever you do just try not to go with the easy way and make the textview property public.

    Marian Edu

    Acorn IT 
    +40 740 036 212

  • Thanks! Could you provide me with an example of how to programmatically access the textbox value? I'm still relatively new to programming in Developer Studio and can't get my head around how to access the value on the screen.  

    I've created a  method in FormA:

     method public character GetFields( ):

           define variable aa as character initial "abc" no-undo.

           aa = this-object:vTextbox1:text.   <-- if I pass "abc" instead of the Textbox1:text it works.

           return aa.

       end method.

    In FormB:

    method private void bButton_Click( input sender as System.Object, input e as System.EventArgs ):

    define variable fOBJ as FormA no-undo.

                   fOBJ = new FormA().      < -this  is my problem.. initializes the form but don't know another way

                   this-object:vTextbox2:text = fOBJ:GetFields().        

            return.

    end method.

    Thanks

    Mark

  • you can try send a paramater like this way:

    _____________________ FormB __________________________

    CONSTRUCTOR PUBLIC   FormB  (

           INPUT myCharacter AS CHARACTER

           ):

    _____________________ FormA __________________________

    DEFINE VARIABLE fOBJ  AS CLASS  FormB NO-UNDO.

    fOBJ = new FormB(myCharacter).