1 Replies - 6529 Views - Last Post: 08 November 2012 - 05:36 PM Rate Topic: -----

#1 ApacheOmega   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 13-October 12

how to select the last cell in the last row of a table in dataGridView

Posted 08 November 2012 - 04:36 PM

Hello
I'm creating a bioinformatics project and I'm trying to do the following.
a)select or get the value of the last cell in the last row (by the push of a button).
I know i could write something like this
dataGridView1.Rows[dataGridView1.RowCount - 1].Cells[0].Value.ToString();


but the problem is since I dont know the exact size of each sequence that is entered its impossible to know the exact size of the rows and columns so in this statement
---Cells[]---
I cant put an exact number inside the box only something like
-----Cells[get final cell]----- (or something like that)
so whats the best way to get the last cell on the last row (dynamically i guess)

b)I want to trace back from the last cell to the beginning (by deciding if the value in the current cell was made by the top, left or diagonal cell next to it and the advancing to that cell) but for each cell chosen on the way back I want a color to remain there thus illustrating the path I took back to the top or beginning.


Thank You
I'm more worried about the first question being answered than anything
Please help
I'd really appreciate it

Is This A Good Question/Topic? 0
  • +

Replies To: how to select the last cell in the last row of a table in dataGridView

#2 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 7053
  • View blog
  • Posts: 23,975
  • Joined: 05-May 12

Re: how to select the last cell in the last row of a table in dataGridView

Posted 08 November 2012 - 05:36 PM

DataGridView.Rows.Count should give you how many rows.

For any given row, you should be able to get the number of cells also by using the Count property.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1