Visually see an object array on my form

Posted on 2006-05-28
Last Modified: 2010-08-05
Public Structure Something
   Item1 as string
   Item2 as string
End Structure

Dim objThing(20,20) as Something

Listview.datasource = objThing
Listbox.datasource = objThing
gridview.datsource = objthing

What is the best .net object to place on my form so I can actually see all the properties of objThing visually?

There must be a fast .net way to do this.
Question by:Hepen
    LVL 96

    Expert Comment

    by:Bob Learned
    You can use the PropertyGrid, but I am not sure if you can use it with a structure.  I don't use structures most of the time, so I haven't tried it.

    LVL 34

    Accepted Solution

    You can use a DataGrid but only if (a) you make objThing a one-dimensional array and (b) revise your structure by giving it properties to expose its items.  This has just worked for me on a form with just one control - DataGrid1

        Public Structure Something
            Public Item1 As String
            Public Item2 As String
            Public ReadOnly Property myitem1() As String
                    Return Item1
                End Get
            End Property
            Public ReadOnly Property myitem2() As String
                    Return Item2
                End Get
            End Property
        End Structure

        Dim objThing(20) As Something

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'make some dummy data
            For i As Integer = 0 To 20
                Dim ms As Something
                ms.Item1 = "structure" & i.ToString & "item1"
                ms.Item2 = "structure" & i.ToString & "item2"
                objThing(i) = ms

            DataGrid1.DataSource = objThing

        End Sub


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    I'm currently working for a company where I have to upgrade over 50 VB6 programs to VB.NET 2008.  So far I'm about half way through, and I've learned quite a few tricks that drastically improve the performance of VB.NET apps. Because there are a…
    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…

    760 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

    9 Experts available now in Live!

    Get 1:1 Help Now