Results 1 to 2 of 2

Thread: Loading array of dynamic to ComboBox?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Location
    in Poland
    Posts
    390

    Loading array of dynamic to ComboBox?

    Hi All

    So, I want to make:

    I have array one-dimension of data. Load this data to combobox. But I want have the array of dynamic.
    I know how to load this array to combobox e.g.

    VB Code:
    1. For lTemp = LBound(sArray) To UBound(sArray)
    2.   Combo1.Additem sArray(lTemp)
    3. Next lTemp

    However I want to be able adding the new of data - therefore the array of dynamic.
    So.... how I should to declare the array of dynamic? about what I should to remember and about what I can't forget.

    I know that I should use keyword ReDim, I don't know unfortunately how to do.

    Some example code can to explain me many here

    Thanks in advance
    I know, I know, my English is bad, sorry .....

  2. #2
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Loading array of dynamic to ComboBox?

    VB Code:
    1. Dim sArray() As String 'Declare
    2.  
    3. Redim sArray(2) 'Redim for 3 Items (0 to 2)
    4.  
    5. sArray(0) = "1"
    6. sArray(1) = "2"
    7. sArray(2) = "3"
    8.  
    9. Redim Preserve sArray(3) 'Redim Preserve 1 more position
    10.  
    11. sArray(3) = "4"
    12.  
    13. 'Or Redim Preserve at the end, no matter how many items it has..
    14. ReDim Preserve sArray(UBound(sArray) + 1)
    15. sArray(UBound(sArray)) = "5"
    Last edited by jcis; Feb 7th, 2007 at 11:13 AM.

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