-
December 14th, 2012, 03:17 PM
#1
How do you get the selected cell of a gridview?
I would like to know how to get the selected cell of a gridview, like for example if a gridview has 4 rows of 4 buttons each, how do you tell if you are clicking button 1 row 1 or button 3 row 4?
Please dont direct me to MSDN or other such sites, I cant understand them and dont find them useful at all.
-
December 28th, 2012, 05:03 AM
#2
Re: How do you get the selected cell of a gridview?
You do something like: -
DataGridView dv;
dv.CurrentCell = new DataGridViewCell(row_index, col_index);
-
January 5th, 2013, 08:31 PM
#3
Re: How do you get the selected cell of a gridview?
Thanks but that doesnt look like it would get the cell your clicking on, it looks more like it would set it.
-
January 8th, 2013, 12:59 AM
#4
Re: How do you get the selected cell of a gridview?
Personally i prefer to use the Repeater, as it includes a few extra options by default and also can be easily formatted to show data anyway you please.. It does take a little extra to setup, but personally i find it worth the work..
The Gridview by default only returns the current row but not the current column.. there are methods to hack a similar sort of functionality into the Gridview, but that would require links to MSDN and such, also none seem to really return the specific column you clicked on, but rely on scanning through the cells for markers or changes...
Now what specifically are you trying to achieve, then perhaps i can spot you some code and pointers to complete this..
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|