Array of control

Discussion in 'Basic4ppc Wishlist' started by bdiscount, Nov 19, 2008.

  1. bdiscount

    bdiscount Active Member Licensed User

    I am wishing for the capability of arrays of controls I know about the control keyword etc but thats a lot of book keeping for me.
    Is it possible with net?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. Cableguy

    Cableguy Expert Licensed User

    What wrong with GETCONTROLS?

    From the Basic4ppc help file:

     
  4. klaus

    klaus Expert Licensed User

    Hi Paulo,

    With the GetControl keyword you get an array of the Controls belonging to another Control.

    The wish of bdiscount is to have for example an array of TextBoxes like
    TextBox(1)
    TextBox(2)
    TextBox(3)
    etc

    and have acces to the properties like
    TextBox(1).Text
    TextBox(2).Text
    etc.

    he would also use it also like
    For i=1 to 3
    TextBox(i).Text = "Text"&i
    Next

    This is different from the GetControls keyword.

    Best regards.
     
  5. Cableguy

    Cableguy Expert Licensed User

    I just did some simple (simpistic actualy) Test..

    added 6 Textboxes, 6 CheckBoxes and 6 Buttons in the designer, to form1...

    Then I added this code:
    Code:
    Sub Globals
       
    'Declare the global variables here.
    Dim b(1)
    End Sub

    Sub App_Start
       Form1.Show
       B()=GetControls(
    "")
       
    For i =0 To ArrayLen(B())-1
       
    Control(B(i)).Text="New Txt"
       
    Next
    End Sub
    And ALL controls got their text prop chnged to the value I mentioned...

    In what way is this diferent from what you think he is aiming for, Klaus?
    GetControls("") get an aray of ALL the controls contained in a Module, with their module prefixe... includng the forms...
     
  6. klaus

    klaus Expert Licensed User

    In your example, ALL controls are changed.

    But the way I understoud bdiscount's wish is that he could define an array of let's say 6 TextBoxes, another array of 5 RadioButtons and so on, but he doesn't want to have all the form's controls in one array.

    I had used Control arrays in Visual Basic.

    Anyway, for me, as Erel said, the Control keyword allowing the same is satisfactory. I just wanted to clarify the subject.

    Best regards.
     
  7. bdiscount

    bdiscount Active Member Licensed User

    arrays

    Klaus is right about what I want. At my age it is a lot easier to keep track of a direct array with out using control. But thats a problem with age and memory going, too old to dev. for sale but ok for personal work. thanks for all the trials

    PS I got the idea from VB etc. I used to dev in C++,VB, Masm
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice