Solved

Display Array content into label

Posted on 2006-11-30
6
466 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

14 Experts available now in Live!

Get 1:1 Help Now