Results 1 to 5 of 5

Thread: Active-X Control with arrays

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Location
    Anywhere
    Posts
    136

    Active-X Control with arrays

    Hi Guys,
    I'm bit confused here and i would really appreciate some help.
    I have no problem developing Active-X controls but never had to use Arrays.
    Let's suppose i have an Active-X calendar that have 100 textbox
    (text1(0), text1(1), etc.)
    Usualy when exposing the properties i did the following :

    Public Property Get Day_Width() As Integer
    Day_Width = m_Day_Width
    End Property

    Public Property Let Day_Width(ByVal New_Day_Width As Integer)
    m_Day_Width = New_Day_Width
    PropertyChanged "Day_Width"
    End Property

    Now, that i have 100 textbox, how shall i do it (exposing its properties, UserControl_WriteProperties, UserControl_ReadProperties, etc.)

    Thanks for any idea

  2. #2
    Fanatic Member
    Join Date
    Aug 2001
    Location
    Connecticut
    Posts
    855
    Seems to me you could use the grid analogy. The cells (textboxes) start as one entity with one set of properties/values (width, height etc). You'd have other user control properties that define number of rows, cols, color, rowheight, etc. Based on that info, the user control dynamically loads the textbox control array into proper position and assigns each the appropriate textbox property values.
    VB 6.0, Access, Sql server, Asp

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Location
    Anywhere
    Posts
    136

    Great but how ?

    How to expose the properties of all these textboxes for the user to access them (i'm tlking here about 100 textboxes) - Usually in the normal cases i had no problem (meaning i didn't have to work with indexes before in Active-X controls)

  4. #4
    Fanatic Member
    Join Date
    Aug 2001
    Location
    Connecticut
    Posts
    855
    Controls that have very similar functionality or share properties are grouped as part of a control array. If they are on the UserControl at design time, you can map the properties to them the same way in ReadProperties/WriteProperties but you simply use a loop:
    for i = 0 to x
    PropBag.WriteProperty "m_Whatever_Width", TextBox(i).Width, 800
    Next

    Those controls that have unique properties are mapped without the loop
    PropBag.WriteProperty "m_Unique_Width", TextBox(SomeIndex).Width, 800
    VB 6.0, Access, Sql server, Asp

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Location
    Anywhere
    Posts
    136

    That's what i mean

    Thanks Ralph

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