How to convert a array

Posted on 2006-04-18
Last Modified: 2010-05-01
I have an array defined as varient, I need to convert it into single, but I do not know the dimension of the array, ie. how big it is.

Any suggestion?

Dim BLOBdata() As Single

How to define the dimension?
Question by:turbot_yu
    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    can you explain more in detail what exactly you are trying to achieve, it is not clear for me.

    if you don't know the dimensions, use UBOUND(variable) and LBOUND(variable) to know the upper and lower bound.
    if you assume that it has more than 1 dimension:
    UBOUND(variable, 0) get's the first dimension's upper bound, UBOUND(variable, 1) the one of the second etc. until ubound returns -1


    Author Comment

    I get a array back from a function return,
    a(..., x,.... )

    x is an array of varient,
    Now I need to convert x to a Single type array, how to do it?

    Author Comment

    I tried Dim BLOBdata(UBound(Waveform)) As Single

    but it said constant data required.
    LVL 142

    Accepted Solution

    you have to make that in 2 lines:
    'first declare the array variable without size
    Dim BLOBdata() As Single
    'now redimension the array
    REDim BLOBdata(UBound(Waveform)) As Single

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Suggested Solutions

    I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now