0

Hey there! You guys have been extremely helpful, thank you. I have a question regarding the DataGridView. What I'm trying to do is take all the values from one column of a DataGridView and put that in either an array, textbox, anything. So far, I have only been able to get the current selected value, not the entire list. Here is the code so far:

        Dim i As Integer
        i = DataGridView1.CurrentRow.Index
        Me.Label2.Text = DataGridView1.Item(0, i).Value

This will show me in a label the current selected entry, not the full list. I'm assuming I need to create an array and then spool the list, however I'm unsure of where to start on that. Any help will be appreciated. Thanks!

2
Contributors
1
Reply
5
Views
5 Years
Discussion Span
Last Post by Pgmer
0

Use list or or Array to hold
Dim sList as new list(of String)
you must use the loop here something like below
For i as integer=0 to DataGridView1.rows.count-1
sList.items.add(DataGridView1.rows(i).item("Column index or Name"))
Next
Note:The above code is not exact code or syntax.. Just an idea to start with...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.