in

Initializing VB.NET DataGridView to have all Combo Boxes; Button to populate from Array


I am trying to initialize a DataGridView to be 12 columns by 15 rows (with labels) and them all be combo boxes. Later on in the code I plan to populate each drop down with items from a single array called names(). But I cannot even get past the load code.

Also, any chance I can get an example or some hooks on how I would later add the names() array to each combo box? I want to press a button that runs a REGEX to extract values from a text file for the array.

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        DataGridView1.RowHeadersWidth = 50
        Dim comboBoxCell As New DataGridViewComboBoxCell
        For row As Integer = 0 To 14            
            Dim i As Integer = DataGridView1.Rows.Add()
            DataGridView1.Rows(i).HeaderCell.Value = (i + 1).ToString()
            For col As Integer = 0 To 11
                DataGridView1(col, row) = comboBoxCell
            Next
        Next
    End Sub

Private Sub RefreshButton_Click(sender As Object, e As EventArgs) Handles RefreshButton.Click

    '***** REGEX code to extract name values from text file add to array called names() *****

    '***** some more code to enumerate DataGridView1 combo boxes with names() array *****

    End Sub



Source: https://stackoverflow.com/questions/70719051/initializing-vb-net-datagridview-to-have-all-combo-boxes-button-to-populate-fro

WHY I GET SEGEMENT FAULT ERROR IN C LANGUAGE WHEN I USE 1-D ARRAY

A Random Anime Quotes app made with flutter