0

I am using .net 2005.
I have created a GridView with one column having a command button.
The DataAdapter, DataSource, DataSet were created in code, not with wizards.
When the command button is clicked, I can't figure out the syntax for retreiving the value from the first cell in the selected row.
Can someone help?

thanks,
earlofroberts

5
Contributors
7
Replies
9
Views
9 Years
Discussion Span
Last Post by cynix008
0

This should work with a Windows Desktop App; strText = Me.dgvGrid.SelectedCells.Item(0).Value.ToString & ""

0

select the 1st cell of rows

dim i as integer
i = datagrid.CurrentRowIndex()

text = Trim(datagrid.Item(i, 0))
0

jx_man,
thanks, but it's a gridview not a datagrid, so it doesn't have the item property.

0

dim string1 as string

string1 = gridview1.rows(row#).cells(cell#).tostring

now, here is the kicker. the first row is row "0"
the first column/cell is "0"

it goes against intuition of using 1...

if you still need help estenson1 at gmail

best,
eric

0

dim string1 as string

string1 = gridview1.rows(row#).cells(cell#).tostring

now, here is the kicker. the first row is row "0"
the first column/cell is "0"

it goes against intuition of using 1...

if you still need help estenson1 at gmail

best,
eric

**********************************************
Thanks a lot , it worked in my case.

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.