Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8765305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:14:51+00:00 2026-06-13T16:14:51+00:00

I have following structure matrix As Dictionary(Of String, Dictionary(Of Class1, Class2)) I would like

  • 0

I have following structure

matrix As Dictionary(Of String, Dictionary(Of Class1, Class2))

I would like to put all the elements of this structure in a datagridview like this:

Column1: String   | Column2: Class1.name     | column3: class2.name

Anyone have a clue on how to pull this off? I am new to datagridviews so have no clue on how to start adding rows and colums (maybe autogenerate the columns??)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:14:52+00:00Added an answer on June 13, 2026 at 4:14 pm

    Tested and working sample:

    Public Class Class1
      Public name As String
    End Class
    Public Class Class2
      Public name As String
    End Class
    
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
      Dim matrix As New Dictionary(Of String, Dictionary(Of Class1, Class2))
      matrix.Add("hello", New Dictionary(Of Class1, Class2))
      matrix("hello").Add(New Class1 With {.name = "123"}, New Class2 With {.name = "321"})
    
      Dim dt As New DataTable
      With dt.Columns
        .Add("Column1")
        .Add("Column2")
        .Add("Column3")
      End With
      For i = 0 To matrix.Count - 1
        Dim key As String = matrix.Keys(i)
        Dim value As Dictionary(Of Class1, Class2) = matrix.Values(i)
        For j = 0 To value.Count - 1
          Dim class1Name As String = value.Keys(j).name
          Dim class2Name As String = value.Values(j).name
          Dim dr As DataRow = dt.NewRow
          With dr
            .Item("Column1") = key
            .Item("Column2") = class1Name
            .Item("Column3") = class2Name
          End With
          dt.Rows.Add(dr)
        Next
      Next
      dataGridView1.DataSource = dt
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to partially collapse a DataFrame /matrix and keep the structure intact
I have following structure. #include <iostream> #include <fstream> #include <string> #include <sstream> #include <vector>
I have following table structure: Table: Plant PlantID: Primary Key PlantName: String Table: Party
i have following url structure http://www.mydomain.com/vpn-offers-p3.html this page should be redirect to http://www.mydomain.com/vpn-offers.php?st=60&page=3 here
I have following structure with example data: id season_id title 1 1 Intro 2
In my rails view(index.html.erb), i have following structure <div> <%= render :partial => create
I have following data structure (simplified): A giant list of the class TestClass public
I have following object structure, deseralized from XML (WS): <ns2:Category> <ns2:CategoryId>800003</ns2:CategoryId> <ns2:CategoryName>Name1</ns2:CategoryName> <ns2:Categories> <ns2:Category>
I have the following structure: <div class=parent> <div id=child1>Content here</div> <div class=child2>Content here</div> </div>
I have the following structure: class User include Mongoid::Document end class Resource include Mongoid::Document

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.