Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

printing array values

Posted on 2006-11-28
3
Medium Priority
?
231 Views
Last Modified: 2010-04-23
Hi,

How can print values of a two dimentional array? the follwoing fucntion returns an array how can print the result?

Private Function Perms(ByVal data As String) As String(,)

...

return Strings
End Function

ayha
0
Comment
Question by:ayha1999
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 400 total points
ID: 18027698
   Sub Main()
        Dim Strings As String(,) = New String(1, 2) {{"1", "2", "3"}, {"4", "5", "6"}}

        PtintArray(Strings)

    End Sub

    Sub PtintArray(ByVal array As String(,))
        Dim maxDim0 As Integer = UBound(array, 1)
        Dim maxDim1 As Integer = UBound(array, 2)
        For i As Integer = 0 To maxDim0
            For j As Integer = 0 To maxDim1
                Console.Write(array(i, j))
                Console.Write(" ")
            Next j
            Console.WriteLine()
        Next i
    End Sub
0
 
LVL 7

Author Comment

by:ayha1999
ID: 18027800
HI,

how can assign the following in an array an print it?

dim arr(,) as string = Perms("ABCD")

the result of the perm will return a two dim array.

ayha
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 18028073
Do you ask how to write function Perms or how to print its result?

If you already have Perms function, you can use PrintArray function from my first post by the following way:

PrintArray(Perms("ABCD"))

or:

dim arr as string(,) = Perms("ABCD")
PrintArray(arr)



0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

886 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