Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 9th, 2007, 06:15 AM
Registered User
 
Join Date: Mar 2007
Location: , , India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Data Grid View

Hello Every Body,

I used "gridTable.Rows(SelectedRow).Cells(0).Value" this code to get value of column(0) of selected row in vb.net 2005. Here gridTable is DataGridView.

Can Any body suggest me How To write same line / code in C#.net.

cool dude
 
Old March 9th, 2007, 06:35 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

gridTable.Rows[SelectedRow].Cells[0].Value;

--

Joe (Microsoft MVP - XML)
 
Old March 10th, 2007, 04:33 AM
Registered User
 
Join Date: Mar 2007
Location: , , India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Finally I got the solution myself

int selectedRow = this.gridTable.CurrentRow.Index;

gridTable.Rows(SelectedRow).Cells(0).Value;

 
Old March 10th, 2007, 05:37 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I don't understand that at all. You asked for c# based on VB.NET, therefore I presumed that SelectedRow was initialised correctly otherwise the VB.NET wouldn't work. Presumably you could use:
Code:
this.gridTable.CurrentRow.Cells[0].Value;
--

Joe (Microsoft MVP - XML)




Similar Threads
Thread Thread Starter Forum Replies Last Post
Paging Data grid view Prakash001 Visual Basic 2005 Basics 0 February 6th, 2008 04:07 AM
Data Grid View Paging in VB.Net Prakash001 Visual Studio 2005 0 January 30th, 2008 07:44 AM
show data record in grid view - sqlserver2005 vinodonline2000 ASP.NET 2.0 Basics 5 August 10th, 2007 05:24 AM
How to display data into Grid View? Somesh ASP.NET 2.0 Professional 5 May 25th, 2007 07:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.