By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,084 Members | 1,956 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,084 IT Pros & Developers. It's quick & easy.

Way to look up index for Cell in datagrid

P: n/a
Is there a way to look up the index for cells in a data grid. I do not
like hard coding numbers into my programs (other than 0 or 1)

Sub DisplayBoundColumnValues(sender as Object, e as
DataGridCommandEventArgs)
Dim bc1 as String = e.Item.Cells(1).Text
Dim bc2 as String = e.Item.Cells(2).Text

End Sub

Thank You

Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Are you looking for a way of accessing cells by column name? Write a simple
method that will loop through the grid's Columns collection, match column
names, and return the index of the matched one. This won't work if the
columns are autogenerated.

Eliyahu

"Paul" <fp******@hotmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Is there a way to look up the index for cells in a data grid. I do not
like hard coding numbers into my programs (other than 0 or 1)

Sub DisplayBoundColumnValues(sender as Object, e as
DataGridCommandEventArgs)
Dim bc1 as String = e.Item.Cells(1).Text
Dim bc2 as String = e.Item.Cells(2).Text

End Sub

Thank You

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.