Solved

Display Array content into label

Posted on 2006-11-30
6
454 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

13 Experts available now in Live!

Get 1:1 Help Now