CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2001
    Location
    Canada
    Posts
    182

    Object array as parameter

    Hi,
    Is there a way to let object array as function parameter? I have different sets of Option Button on the form and I want to create a function to search a specific item on each of them(compare the Caption of the option button with a specific string). I do not want to create the similar functions for each of the Option Button arrays. What I suppose to do is create a function like:
    ======
    Private Function GetOptionIndex(strItem As String, opt() As OptionButton) As Long
    ======
    Here, opt() is the object array which I imaged, actually, there isn't such datatype. Can you help me?

    Any suggestion will be highly appreciated.


    Regards,

    Michi
    MCSE, MCDBA

  2. #2
    Join Date
    Apr 2000
    Posts
    737

    Re: Object array as parameter

    check out the following code which display the value of each option button (2 of them, with index 0 and 1).


    private Function getoption(opt as Variant) as Long

    Debug.print opt(1).Value
    Debug.print opt(0).Value

    End Function

    private Sub Form_Load()
    getoption Option1
    End Sub






    HTH

    cksiow
    http://vblib.virtualave.net - share our codes

  3. #3
    Join Date
    May 2001
    Location
    Canada
    Posts
    182

    Re: Object array as parameter

    Thank you, HTH. It works very well. And I can also use the Object data type. That is:

    private Function getoption(opt as Object) as Long



    Regards,

    Michi
    MCSE, MCDBA

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

Featured