Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 21st, 2006, 10:24 PM
Registered User
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to jeff_cafm
Default 1 and 2 dimensional arrays

I'm going to try my best to explain this, so bear with me. I'm creating a parsing engine for some emails that i receive so i can more easily monitor and control the data. I've begun creating a class that parses out the information and stores the values into a public valued array so i can cycle through the info. (may not be the best idea so open to any others) but there are a total of 6 arrays. 2 of which are 2 dimensional. The problem i'm having is i need/want to store one of the 1 dimensional arrays into a 2 dimensional array. example:

oneDime(0) = "value 1"
oneDime(1) = "value 2"
oneDime(2) = "value 3"

twoDime(0,1) = "group heading"
twoDime(1,1) = "group date"
twoDime(2,1) = oneDime

They are both casted as string() arrays:
Private oneDime(2) As String
Private twoDime(,) As String <- casted this way because i do not know the total values needed so i am using ReDim Preserve to adjust as needed.

The error i'm getting is this:
Value of type '2-dimensional array of String' cannot be converted to 'String'.

Please help.

Jeff Dupont
-CAFM Developer
Old April 24th, 2006, 03:05 PM
Friend of Wrox
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts

What does CAFM stand for?

If the compiler were a little smarter, you could have
    twoDime(2) = oneDime
but it's not. "oneDime" is (essentially) a reference to the location of the oneDime array. That can't be stored in twoDime(2, 1), because that is essentially the address of the location of a string.
I believe you are going to have to
    For i = oneDime.GetLowerBound(0) To oneDime.GetUpperBound(0)
        twoDime(2, i) = oneDime(i)

Similar Threads
Thread Thread Starter Forum Replies Last Post
muti dimensional arrays help:( chris1012 Java Basics 6 December 22nd, 2007 01:11 PM
1 and 2 dimensional arrays jeff_cafm VB.NET 2002/2003 Basics 1 April 26th, 2006 05:02 PM
2 dimensional array venterjo General .NET 2 January 23rd, 2005 09:04 AM
Multidemmesional Arrays OR arrays gmoney060 Classic ASP Basics 3 November 1st, 2004 03:42 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.