0 Replies - 436 Views - Last Post: 20 August 2012 - 03:02 PM Rate Topic: -----

#1 ichthuso1  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 42
  • Joined: 18-April 12

DataGridView: using a loop of selected items rather than currentrow

Posted 20 August 2012 - 03:02 PM

First real time working with a datagridview (Model_dgv) and at this point I have a loop cycling through all the selected cells. Ideally, each cell will have information from one of the columns added to a textbox. Currently, instead of referencing the object "model" as set up in the loop, I am adding based off of my current row, so obviously I am not getting all of the items, but the most recent selection repeated N times (with N = model_dgv.selectedcells.count)

            For Each model In Model_dgv.SelectedCells
                'if it's different add it (so '' becomes SERIES1; SERIES1 remains SERIES1, SERIES2 becomes SERIES2; SERIES1)
                If lvl1_tb.Text <> Model_dgv.Item("Model Lvl1", Model_dgv.CurrentRow.Index).Value.ToString.Trim Then
                    lvl1_tb.Text &= Model_dgv.Item("Model Lvl1", Model_dgv.CurrentRow.Index).Value.ToString.Trim
                End If
            ...



simply, I don't know enough about DGV to know how to write the line to call the cell based on the loop rather than the current selection. Any thoughts/comments? Places to start and research.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1