Solved

Display Array content into label

Posted on 2006-11-30
6
485 Views
Last Modified: 2008-02-01
Using VB.NET (.NET 1.1) and ASP.NET, I am trying to display the content of a 2 Dimentional Array into a label on a web form, but I am getting this error:

Value of type 2-dimensional array of Integer cannot be converted to String
0
Comment
Question by:yaney00074
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 10

Expert Comment

by:Kinger247
ID: 18047177
What code are you using ? something like this ?

dim arr(5,5) as string

Label1.Text = arr(1,1).tostring
0
 

Author Comment

by:yaney00074
ID: 18047287
I have an object that has a property called GroupID with is a 2 dimensional array

    Public Property GroupID() As Integer(,)
        Get
            Return Me.mint_groupID
        End Get
        Set(ByVal Value As Integer(,))
            Me.mint_groupID = Value
        End Set
    End Property

objEmployee.GroupID  = GetEmployeeGroupAnRole() As Integer(,)

That fucntion returns a value pair collection of (GroupID, RoleID) the user's belong to

So practically I am getting somethin like this

(0,0) = 222
(0,1) = 3
(1,0) = 232
(1,1) = 1
(,)
(,)
'
'
'
etc...

Let me know if you need further detail
0
 

Author Comment

by:yaney00074
ID: 18047390
I need to know how to loop into this array to display all the content

(0,0) = 222
(0,1) = 3
(1,0) = 232
(1,1) = 1
(,)
(,)
'
'
'
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 18047446
if you are not doing arithemetic on the 'numbers', then you would be better off to treat them as strings

    Dim mint_groupID() as String(,)

    Public Property GroupID() As String(,)
        Get
            Return Me.mint_groupID
        End Get
        Set(ByVal Value As String(,))
            Me.mint_groupID = Value
        End Set
    End Property

objEmployee.GroupID  = GetEmployeeGroupAnRole() As String(,)

AW
0
 

Author Comment

by:yaney00074
ID: 18047736
What I need is this loop to work using a 2 dimensional array

           For i = 0 To UBound(cUser.GroupID, 1) - 1
                For j = 0 To UBound(cUser.GroupID, 1) - 1
                    Me.lblGroup.Text = "(" & cUser.GroupID(i, 0).ToString & ", " & cUser.GroupID(0, j) & ")" & "<br/>"
                Next
            Next

Question:
How do i loop to display the content of the array?
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 500 total points
ID: 18049817
         For i = 0 To UBound(cUser.GroupID, 1) - 1
                For j = 0 To UBound(cUser.GroupID, 2) - 1
                    Me.lblGroup.Text = Me.lblGroup.Text  & "(" & cUser.GroupID(i, 0).ToString & ", " & cUser.GroupID(0, j) & ")" & "<br/>"
                Next
            Next

AW
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.Net error: An exception occurred during a WebClient request 6 42
ModalPopup  question 22 40
Need help with another query 10 40
VB.net VSTO Excel Ribbon error 4 14
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.

696 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