+ Reply to Thread
Results 1 to 3 of 3

Form Object assignment

  1. #1
    Registered User
    Join Date
    12-15-2006
    Posts
    2

    Form Object assignment

    Hi folks,

    Let me first thank you for reading.

    What I would like to do in my userform is to store a group of optionbutton's into an array, so whenever I need to iterate through all the optionbutton's I can just use a FOR loop and quickly get the object reference.

    Suppose I declared the following:


    Type myType
    xInt as integer
    xOption as OptionButton
    end type
    ...
    Dim xOptions(1 to 5) as myType


    Whenever I do

    xOptions(1).xOption = UserForm1.OptionButton1

    I get a runtime error, because it seems to always go after the default property of OptionButton, which means it's trying to assign OptionButton1.Value into xOption. How do I assign the OBJECT OptionButton1 into xOption? I couldn't find CASTING, or methods that returns the object...and of course I have similar wishes for labels/textbox/...etc.

    FYI: OptionButton1 was created using the Form-GUI

    Thanks again.

  2. #2
    Forum Contributor
    Join Date
    12-04-2003
    Posts
    360
    use a collection instead.

  3. #3
    Registered User
    Join Date
    12-15-2006
    Posts
    2
    What would it look like? Wouldn't I still have the same problem?

    xCollection.add(UserForm1.OptionButton1)

    A collection might be better, but my problem isn't how to put them together, but to reference the object as objects.

    Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1