Results 1 to 9 of 9

Thread: Why doesn't this array thing work?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    229

    Why doesn't this array thing work?

    VB Code:
    1. Dim FData() As String
    2.  
    3.     ReDim FData(0) As String
    4.     ReDim FData(0, 0) As String
    5.    
    6.     FData(0) = "ABC"

    Can't I put text in the first level of this multi-dimentional array?

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Since you ReDimmed it to a two dimensional array...... you have to specify where the data goes. FData(0,0)
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    229
    Wait a sec...

    This isn't making sense to me!

    In php you can assign data into FData[0]. I thought this would also be possible in VB! Because if I put FData[0,0] = "ABC", then FData[0] is empty. but i wanted to have a database structure type of multidimentional array!

  4. #4
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    VB Code:
    1. Dim FData() As String
    2.     FData(0) = "ABC"
    3.     FData(1) = "DEF"
    4.     FData(2) = "HIJ"

    And so on, : Or am i loosin the point of what u wanna do, but u dont have to re-dim it,
    Wayne

  5. #5
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    Originally posted by INF3RN0666
    In php you can assign data into FData[0]. I thought this would also be possible in VB!
    Assumption incorrect (like that anyway)

  6. #6
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    Oh a little addition to wot i sed above:

    VB Code:
    1. Dim FData() As String
    2.     FData(0) = "ABC"
    3.     FData(1) = "DEF"
    4.     FData(2) = "HIJ"
    5.  
    6.     ' Array's take up memory etc, so u need to erase it AFTER you are DONE
    7.     ' IE: msgbox FData(0)
    8.     Erase FData()
    Wayne

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    229
    so i cant assign anything to the first level of the array? That's dumb if it's true!

  8. #8
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    You can do:
    VB Code:
    1. Dim Arr(5,1) As String
    2.  
    3.     Arr(0,0) = "ABC"
    4.     Arr(0,1) = "DEF"
    5.     Arr(1,0) = "HIJ"
    6.     Arr(1,1) = "KLM"
    7.    ' .......

  9. #9
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    Originally posted by INF3RN0666
    so i cant assign anything to the first level of the array? That's dumb if it's true!
    how do u mean by "First Level"?

    VB Code:
    1. FData() = Split("H E L L O"," ")

    u can do that (im not certain if thats what u mean tho)
    Wayne

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