Results 1 to 4 of 4

Thread: Control Arrays?

  1. #1
    Guest

    Question

    I have a frame with 3 option buttons indicating types of access (read only/read write/administrative for example).

    I need one such frame for each application the users have access to.

    I don't know how many applications I have until run time.

    I want to dynamically create frames at run time where each set of 3 buttons are independent of each other.

    How can I do this?

    Thanks for the help!

  2. #2
    Guest

    Smile

    Okay, I got it to work by creating an activeX control with the frame & 3 buttons.

    If there are any other suggestions, they are appreciated.

    Also, if I put a label in there, can I change the label caption inside of the frame dynamically?

  3. #3
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    One way to do it

    Yes, create a public property called "LabelCaption" as a string. Then assign the value for the property to the label's caption, like this:
    Code:
    Public Property Get LabelCaption() As String
        LabelCaption= Label1.Caption
    End Property
    
    Public Property Let LabelCaption(ByVal asNewCaption As String)
        Label1.Caption = asNewCaption
    End Property
    ~seaweed

  4. #4
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Here's another idea

    So your user can tell which option button is clicked at runtime (and so they can set the default at runtime) you may want to create an AccessType property that returns the access type currently selected.

    This property would return an integer 0, 1, or 2 that indicates which option button is selected. This is assuming that your option buttons are a control array with indexes 0, 1, and 2.

    Example:
    Code:
    ' Private variable holds public property value
    Private miAccessType As Integer
    
    Private Sub optAccessType_Click(Index As Integer)
        ' Set private variable = index of selected option button when button is clicked
        miAccessType = Index
    End Sub
    
    Public Property Get AccessType() As Integer
        ' Returns index of selected option button
        AccessType = miAccessType
    End Property
    
    Public Property Let AccessType(ByVal aiNewValue As Integer)
        ' This allows user to set initial value of option button
        
        ' A little error checking may be necessary...only let the user
        ' select 0, 1, or 2.  An incorrect entry simply selects 0
        If aiNewValue < 0 Or aiNewValue > 2 Then aiNewValue = 0
        
        miAccessType = aiNewValue
        optAccessType(aiNewValue).Value = True
    End Property
    Hope that helps,
    ~seaweed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width